TYPO3CMS
9.5
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
q
r
s
t
u
v
w
Files
File List
File Members
All
$
d
e
r
u
Functions
Variables
$
e
r
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Pages
InMemoryLogWriter.php
Go to the documentation of this file.
1
<?php
2
declare(strict_types = 1);
3
4
namespace
TYPO3\CMS\Adminpanel\Log
;
5
6
/*
7
* This file is part of the TYPO3 CMS project.
8
*
9
* It is free software; you can redistribute it and/or modify it under
10
* the terms of the GNU General Public License, either version 2
11
* of the License, or any later version.
12
*
13
* For the full copyright and license information, please read the
14
* LICENSE.txt file that was distributed with this source code.
15
*
16
* The TYPO3 project - inspiring people to share!
17
*/
18
19
use
TYPO3\CMS\Adminpanel\Utility\MemoryUtility
;
20
use
TYPO3\CMS\Core\Log\LogLevel
;
21
use
TYPO3\CMS\Core\Log\LogRecord
;
22
use
TYPO3\CMS\Core\Log\Writer\AbstractWriter
;
23
use
TYPO3\CMS\Core\Utility\GeneralUtility
;
24
29
class
InMemoryLogWriter
extends
AbstractWriter
30
{
31
public
static
$log
= [];
32
33
private
static
$memoryLock
=
false
;
34
42
public
function
writeLog
(
LogRecord
$record): self
43
{
44
// Guard: Locked Writer
45
if
(self::$memoryLock ===
true
) {
46
return
$this;
47
}
48
49
// Guard: Memory Usage
50
if
(!self::$memoryLock &&
MemoryUtility::isMemoryConsumptionTooHigh
()) {
51
$this->
lockWriter
();
52
return
$this;
53
}
54
55
self::$log[] = $record;
56
57
return
$this;
58
}
59
63
protected
function
lockWriter
(): void
64
{
65
self::$memoryLock =
true
;
67
$record = GeneralUtility::makeInstance(
68
LogRecord::class,
69
'TYPO3.CMS.AdminPanel.Log.InMemoryLogWriter'
,
70
LogLevel::INFO
,
71
'... Further log entries omitted, memory usage too high.'
72
);
73
self::$log[] = $record;
74
}
75
}
TYPO3\CMS\Adminpanel\Log\InMemoryLogWriter\$memoryLock
static $memoryLock
Definition:
InMemoryLogWriter.php:33
TYPO3\CMS\Core\Log\LogLevel\INFO
const INFO
Definition:
LogLevel.php:85
TYPO3\CMS\Adminpanel\Log
Definition:
DoctrineSqlLogger.php:4
TYPO3\CMS\Core\Log\LogRecord
Definition:
LogRecord.php:21
TYPO3\CMS\Adminpanel\Log\InMemoryLogWriter
Definition:
InMemoryLogWriter.php:30
TYPO3\CMS\Adminpanel\Utility\MemoryUtility\isMemoryConsumptionTooHigh
static bool isMemoryConsumptionTooHigh()
Definition:
MemoryUtility.php:38
TYPO3\CMS\Adminpanel\Log\InMemoryLogWriter\$log
static $log
Definition:
InMemoryLogWriter.php:31
TYPO3\CMS\Adminpanel\Log\InMemoryLogWriter\writeLog
self writeLog(LogRecord $record)
Definition:
InMemoryLogWriter.php:42
TYPO3\CMS\Core\Log\Writer\AbstractWriter
Definition:
AbstractWriter.php:24
TYPO3\CMS\Core\Utility\GeneralUtility
Definition:
GeneralUtility.php:45
TYPO3\CMS\Adminpanel\Utility\MemoryUtility
Definition:
MemoryUtility.php:27
TYPO3\CMS\Adminpanel\Log\InMemoryLogWriter\lockWriter
lockWriter()
Definition:
InMemoryLogWriter.php:63
TYPO3\CMS\Core\Log\LogLevel
Definition:
LogLevel.php:21
doxygen
typo3
sysext
adminpanel
Classes
Log
InMemoryLogWriter.php
Generated on Tue Oct 5 2021 01:56:48 for TYPO3CMS by
1.8.18