TYPO3 CMS
TYPO3_6-2
Main Page
Related Pages
+
Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
+
Variables
$
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
r
s
t
u
v
w
+
Files
File List
+
File Members
+
All
$
(
_
a
c
d
e
f
h
i
l
o
p
r
s
t
u
x
+
Functions
_
a
c
d
e
f
i
l
o
p
r
s
u
x
+
Variables
$
(
_
a
d
e
h
i
p
r
s
t
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Pages
PhpErrorLogWriter.php
Go to the documentation of this file.
1
<?php
2
namespace
TYPO3\CMS\Core\Log\Writer
;
3
17
use
TYPO3\CMS\Core\Log\LogRecord
;
18
use
TYPO3\CMS\Core\Log\LogLevel
;
19
26
class
PhpErrorLogWriter
extends
AbstractWriter
{
27
35
public
function
writeLog
(
LogRecord
$record) {
36
$levelName =
LogLevel::getName
($record->
getLevel
());
37
$data =
''
;
38
$recordData = $record->
getData
();
39
if
(!empty($recordData)) {
40
// According to PSR3 the exception-key may hold an \Exception
41
// Since json_encode() does not encode an exception, we run the _toString() here
42
if
(isset($recordData[
'exception'
]) && $recordData[
'exception'
] instanceof \
Exception
) {
43
$recordData[
'exception'
] = (string)$recordData[
'exception'
];
44
}
45
$data =
'- '
. json_encode($recordData);
46
}
47
$message = sprintf(
48
'TYPO3 [%s] request="%s" component="%s": %s %s'
,
49
$levelName,
50
$record->
getRequestId
(),
51
$record->
getComponent
(),
52
$record->
getMessage
(),
53
$data
54
);
55
if
(FALSE === error_log($message)) {
56
throw
new \RuntimeException(
'Could not write log record to PHP error log'
, 1345036336);
57
}
58
return
$this;
59
}
60
61
}
TYPO3\CMS\Core\Log\LogRecord\getMessage
getMessage()
Definition:
LogRecord.php:223
TYPO3\CMS\Core\Log\LogRecord\getLevel
getLevel()
Definition:
LogRecord.php:171
TYPO3\CMS\Core\Log\LogRecord\getComponent
getComponent()
Definition:
LogRecord.php:127
LogRecord
TYPO3\CMS\Core\Log\Writer\PhpErrorLogWriter
Definition:
PhpErrorLogWriter.php:26
TYPO3\CMS\Core\Log\LogRecord\getRequestId
getRequestId()
Definition:
LogRecord.php:243
TYPO3\CMS\Core\Log\LogRecord
Definition:
LogRecord.php:25
TYPO3\CMS\Core\Log\LogRecord\getData
getData()
Definition:
LogRecord.php:191
TYPO3\CMS\Core\Log\Writer
Definition:
AbstractWriter.php:2
TYPO3\CMS\Core\Log\Writer\PhpErrorLogWriter\writeLog
writeLog(LogRecord $record)
Definition:
PhpErrorLogWriter.php:35
LogLevel
TYPO3\CMS\Core\Log\Writer\AbstractWriter
Definition:
AbstractWriter.php:21
TYPO3\CMS\Core\Log\LogLevel\getName
static getName($level)
Definition:
LogLevel.php:111
TYPO3\CMS\Core\Exception
Definition:
Exception.php:20
typo3
sysext
core
Classes
Log
Writer
PhpErrorLogWriter.php
Generated on Wed Aug 7 2019 09:52:21 for TYPO3 CMS by
1.8.13