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
▼
TYPO3 CMS
TYPO3 CMS
Test List
Todo List
Deprecated List
►
Namespace Members
►
Classes
▼
Files
►
File List
►
File Members
►
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Pages
DatabaseWriter.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
24
class
DatabaseWriter
extends
\TYPO3\CMS\Core\Log\Writer\AbstractWriter
{
25
31
protected
$logTable
=
'sys_log'
;
32
39
public
function
setLogTable
($tableName) {
40
$this->logTable = $tableName;
41
return
$this;
42
}
43
49
public
function
getLogTable
() {
50
return
$this->logTable
;
51
}
52
60
public
function
writeLog
(
LogRecord
$record) {
61
$data =
''
;
62
$recordData = $record->
getData
();
63
if
(!empty($recordData)) {
64
// According to PSR3 the exception-key may hold an \Exception
65
// Since json_encode() does not encode an exception, we run the _toString() here
66
if
(isset($recordData[
'exception'
]) && $recordData[
'exception'
] instanceof \
Exception
) {
67
$recordData[
'exception'
] = (string)$recordData[
'exception'
];
68
}
69
$data =
'- '
. json_encode($recordData);
70
}
71
72
$fieldValues = array(
73
'request_id'
=> $record->
getRequestId
(),
74
'time_micro'
=> $record->
getCreated
(),
75
'component'
=> $record->
getComponent
(),
76
'level'
=> $record->
getLevel
(),
77
'message'
=> $record->
getMessage
(),
78
'data'
=> $data
79
);
80
81
if
(FALSE === $this->
getDatabaseConnection
()->exec_INSERTquery($this->logTable, $fieldValues)) {
82
throw
new \RuntimeException(
'Could not write log record to database'
, 1345036334);
83
}
84
return
$this;
85
}
86
90
protected
function
getDatabaseConnection
() {
91
return
$GLOBALS
[
'TYPO3_DB'
];
92
}
93
94
}
TYPO3\CMS\Core\Log\LogRecord\getMessage
getMessage()
Definition:
LogRecord.php:223
TYPO3\CMS\Core\Log\Writer\DatabaseWriter\getDatabaseConnection
getDatabaseConnection()
Definition:
DatabaseWriter.php:90
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\LogRecord\getRequestId
getRequestId()
Definition:
LogRecord.php:243
TYPO3\CMS\Core\Log\Writer\DatabaseWriter
Definition:
DatabaseWriter.php:24
TYPO3\CMS\Core\Log\LogRecord\getCreated
getCreated()
Definition:
LogRecord.php:147
TYPO3\CMS\Core\Log\Writer\DatabaseWriter\getLogTable
getLogTable()
Definition:
DatabaseWriter.php:49
TYPO3\CMS\Core\Log\Writer\DatabaseWriter\writeLog
writeLog(LogRecord $record)
Definition:
DatabaseWriter.php:60
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\DatabaseWriter\setLogTable
setLogTable($tableName)
Definition:
DatabaseWriter.php:39
TYPO3\CMS\Core\Log\Writer
Definition:
AbstractWriter.php:2
$GLOBALS
if(!defined('TYPO3_MODE')) $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_userauth.php']['logoff_pre_processing'][]
Definition:
ext_localconf.php:5
TYPO3\CMS\Core\Log\Writer\DatabaseWriter\$logTable
$logTable
Definition:
DatabaseWriter.php:31
TYPO3\CMS\Core\Log\Writer\AbstractWriter
Definition:
AbstractWriter.php:21
TYPO3\CMS\Core\Exception
Definition:
Exception.php:20
typo3
sysext
core
Classes
Log
Writer
DatabaseWriter.php
Generated on Wed Aug 7 2019 09:52:21 for TYPO3 CMS by
1.8.13