Logger implements LoggerInterface uses LoggerTrait
Logger to log events and data for different components.
Table of Contents
Interfaces
- LoggerInterface
Properties
- $minimumLogLevel : int
- Minimum log level, anything below this level will be ignored.
- $name : string
- Logger name or component for which this logger is meant to be used for.
- $processors : array<string|int, mixed>
- Processors used by this logger
- $requestId : string
- Unique ID of the request
- $writers : array<string|int, mixed>
- Writers used by this logger
Methods
- __construct() : mixed
- Constructor.
- __sleep() : array<string|int, mixed>
- Remove everything except the name, to be able to restore it on wakeup
- __wakeup() : mixed
- Re-initialize instance with creating a new instance with up to date information
- addProcessor() : mixed
- Adds a processor to the logger.
- addWriter() : Logger
- Adds a writer to this logger
- getName() : string
- Gets the logger's name.
- getProcessors() : array<string|int, mixed>
- Returns all added processors indexed by log level
- getWriters() : array<string|int, mixed>
- Returns all configured writers indexed by log level
- log() : void
- Adds a log record.
- callProcessors() : LogRecord
- Calls all processors and returns log record
- getMinimumLogLevel() : int
- Gets the minimum log level for which log records are written.
- setMinimumLogLevel() : Logger
- Sets the minimum log level for which log records are written.
- writeLog() : mixed
- Passes the \TYPO3\CMS\Core\Log\LogRecord to all registered writers.
Properties
$minimumLogLevel
Minimum log level, anything below this level will be ignored.
protected
int
$minimumLogLevel
$name
Logger name or component for which this logger is meant to be used for.
protected
string
$name
= ''
This should be a dot-separated name and should normally be based on the class name or the name of a subsystem, such as core.t3lib.cache.manager, core.backend.workspaces or extension.news
$processors
Processors used by this logger
protected
array<string|int, mixed>
$processors
= []
$requestId
Unique ID of the request
protected
string
$requestId
= ''
$writers
Writers used by this logger
protected
array<string|int, mixed>
$writers
= []
Methods
__construct()
Constructor.
public
__construct(string $name[, string $requestId = '' ]) : mixed
Parameters
- $name : string
-
A name for the logger.
- $requestId : string = ''
-
Unique ID of the request
__sleep()
Remove everything except the name, to be able to restore it on wakeup
public
__sleep() : array<string|int, mixed>
Return values
array<string|int, mixed>__wakeup()
Re-initialize instance with creating a new instance with up to date information
public
__wakeup() : mixed
addProcessor()
Adds a processor to the logger.
public
addProcessor(string $minimumLevel, ProcessorInterface $processor) : mixed
Parameters
- $minimumLevel : string
- $processor : ProcessorInterface
-
The processor to add.
addWriter()
Adds a writer to this logger
public
addWriter(string $minimumLevel, WriterInterface $writer) : Logger
Parameters
- $minimumLevel : string
- $writer : WriterInterface
-
Writer object
Return values
Logger —$this
getName()
Gets the logger's name.
public
getName() : string
Return values
string —Logger name.
getProcessors()
Returns all added processors indexed by log level
public
getProcessors() : array<string|int, mixed>
Return values
array<string|int, mixed>getWriters()
Returns all configured writers indexed by log level
public
getWriters() : array<string|int, mixed>
Return values
array<string|int, mixed>log()
Adds a log record.
public
log(int|string $level, string|Stringable $message[, array<string|int, mixed> $data = [] ]) : void
Parameters
- $level : int|string
-
Log level. Value according to \TYPO3\CMS\Core\Log\LogLevel. Alternatively accepts a string.
- $message : string|Stringable
-
Log message.
- $data : array<string|int, mixed> = []
-
Additional data to log
callProcessors()
Calls all processors and returns log record
protected
callProcessors(LogRecord $record) : LogRecord
Parameters
- $record : LogRecord
-
Record to process
Tags
Return values
LogRecord —Processed log record
getMinimumLogLevel()
Gets the minimum log level for which log records are written.
protected
getMinimumLogLevel() : int
Return values
int —Minimum log level
setMinimumLogLevel()
Sets the minimum log level for which log records are written.
protected
setMinimumLogLevel(int $level) : Logger
Parameters
- $level : int
-
Minimum log level
Return values
Logger —$this
writeLog()
Passes the \TYPO3\CMS\Core\Log\LogRecord to all registered writers.
protected
writeLog(LogRecord $record) : mixed
Parameters
- $record : LogRecord