LogTargetTrait

Type
Trait
Namespace
craft\base
Since
3.1.23

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

View source (opens new window)

# Public Properties

Property Description
includeUserIp boolean (opens new window) – Whether the user IP should be included in the default log prefix.

# includeUserIp

Type
boolean (opens new window)
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 (opens new window)

View source (opens new window)

# Public Methods

Method Description
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 (opens new window) is configured it will return the result of the callback.

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

Arguments

Returns

string (opens new window) – The prefix string

Throws

# Protected Methods

Method Description
getContextMessage() Generates the context information to be logged.

# getContextMessage()

Generates the context information to be logged.

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

Returns

string (opens new window) – The context information. If an empty string, it means no context information.