LogRecord implements ArrayAccess

Log record

Tags
todo:

Consider declaring this DTO final

Table of Contents

Interfaces

ArrayAccess

Properties

$component  : string
The component where the record was created
$created  : float
Creation timestamp with microseconds
$data  : array<string|int, mixed>
Additional log data
$level  : string
Severity level
$message  : string
Log message one-liner
$requestId  : string
Unique ID of the request

Methods

__construct()  : mixed
Constructor.
__toString()  : string
Convert record to string for simple output, like echo().
addData()  : LogRecord
Adds additional log data to already existing data and overwrites previously data using the same array keys.
getComponent()  : string
Returns the component
getCreated()  : float
Returns the creation time
getData()  : array<string|int, mixed>
Returns the log data
getLevel()  : string
Returns the severity level
getMessage()  : string
Returns the log message
getRequestId()  : string
Returns the request ID
offsetExists()  : bool
Checks whether an offset exists, required by ArrayAccess interface
offsetGet()  : mixed
Offset to retrieve, required by ArrayAccess interface
offsetSet()  : void
Offset to set, required by ArrayAccess interface
offsetUnset()  : void
Offset to unset, required by ArrayAccess interface
setComponent()  : LogRecord
Sets the affected component
setCreated()  : LogRecord
Sets the the creation time
setData()  : LogRecord
Sets log data array
setLevel()  : LogRecord
Sets the severity level
setMessage()  : LogRecord
Sets the log message
setRequestId()  : LogRecord
Sets the request ID
toArray()  : array<string|int, mixed>
Convert record to array

Properties

$component

The component where the record was created

protected string $component = ''

$created

Creation timestamp with microseconds

protected float $created = 0.0

$data

Additional log data

protected array<string|int, mixed> $data = []

$level

Severity level

protected string $level = \Psr\Log\LogLevel::INFO

$message

Log message one-liner

protected string $message = ''

$requestId

Unique ID of the request

protected string $requestId = ''

Methods

__construct()

Constructor.

public __construct(string $component, string $level, string $message[, array<string|int, mixed> $data = [] ][, string $requestId = '' ]) : mixed
Parameters
$component : string

Affected component

$level : string

Severity level (see \TYPO3\CMS\Core\Log\Level)

$message : string

Log message

$data : array<string|int, mixed> = []

Additional data

$requestId : string = ''

Unique ID of the request

__toString()

Convert record to string for simple output, like echo().

public __toString() : string

Contents of data array is appended as JSON-encoded string

Return values
string

addData()

Adds additional log data to already existing data and overwrites previously data using the same array keys.

public addData(array<string|int, mixed> $data) : LogRecord
Parameters
$data : array<string|int, mixed>
Return values
LogRecord

getComponent()

Returns the component

public getComponent() : string
Return values
string

Component key

getCreated()

Returns the creation time

public getCreated() : float
Return values
float

Creation time as float

getData()

Returns the log data

public getData() : array<string|int, mixed>
Return values
array<string|int, mixed>

getLevel()

Returns the severity level

public getLevel() : string
Tags
see
Level
Return values
string

Severity level

getMessage()

Returns the log message

public getMessage() : string
Return values
string

Log message

getRequestId()

Returns the request ID

public getRequestId() : string
Return values
string

offsetExists()

Checks whether an offset exists, required by ArrayAccess interface

public offsetExists(mixed $offset) : bool
Parameters
$offset : mixed
Return values
bool

offsetGet()

Offset to retrieve, required by ArrayAccess interface

public offsetGet(mixed $offset) : mixed
Parameters
$offset : mixed
Tags
todo:

Set return type to mixed in v13

Attributes
#[ReturnTypeWillChange]

offsetSet()

Offset to set, required by ArrayAccess interface

public offsetSet(mixed $offset, mixed $value) : void
Parameters
$offset : mixed
$value : mixed

offsetUnset()

Offset to unset, required by ArrayAccess interface

public offsetUnset(mixed $offset) : void
Parameters
$offset : mixed

setComponent()

Sets the affected component

public setComponent(string $component) : LogRecord
Parameters
$component : string

Component key

Return values
LogRecord

setCreated()

Sets the the creation time

public setCreated(float $created) : LogRecord
Parameters
$created : float

Creation time as float

Return values
LogRecord

setData()

Sets log data array

public setData(array<string|int, mixed> $data) : LogRecord
Parameters
$data : array<string|int, mixed>
Return values
LogRecord

setLevel()

Sets the severity level

public setLevel(string $level) : LogRecord
Parameters
$level : string

Severity level

Tags
see
Level
Return values
LogRecord

setMessage()

Sets the log message

public setMessage(string|object $message) : LogRecord
Parameters
$message : string|object

Log message. Usually a string, or an object that can be casted to string (implements __toString())

Return values
LogRecord

setRequestId()

Sets the request ID

public setRequestId(string $requestId) : LogRecord
Parameters
$requestId : string
Return values
LogRecord

toArray()

Convert record to array

public toArray() : array<string|int, mixed>
Return values
array<string|int, mixed>

        
On this page

Search results