Skip to content

LogTargetTrait ​

Type
Trait
Namespace
craft\base
Implemented by
craft\log\FileTarget, craft\log\StreamLogTarget
Since
3.1.23

LogTargetTrait implements the common methods and properties for log target classes.

View source

Public Properties ​

PropertyDescription
includeUserIpboolean – Whether the user IP should be included in the default log prefix.

includeUserIp ​

Type
boolean
Default value
false
Since
3.0.25

Whether the user IP should be included in the default log prefix.

See also yii\log\Target::$prefix

View source

Public Methods ​

MethodDescription
getMessagePrefix()Returns a string to be prefixed to the given message.

getMessagePrefix() ​

Returns a string to be prefixed to the given message.

If yii\log\Target::$prefix is configured it will return the result of the callback.

See also yii\log\Target::getMessagePrefix()View source

Arguments ​

Returns ​

string – The prefix string

Throws ​

Protected Methods ​

MethodDescription
getContextMessage()Generates the context information to be logged.

getContextMessage() ​

Generates the context information to be logged.

See also yii\log\Target::getContextMessage()View source

Returns ​

string – The context information. If an empty string, it means no context information.