Documentation

FileTarget extends FileTarget
in package

FileTarget class records log messages in a file.

Table of Contents

$enableRotation  : bool
$logVars  : array<string|int, mixed>
export()  : mixed
Writes log messages to a file.
formatMessage()  : string
Formats a log message for display as a string.
init()  : mixed
Initializes the route.
getContextMessage()  : string
Generates the context information to be logged.

Properties

$enableRotation

public bool $enableRotation = false

whether log files should be rotated when they reach a certain [[maxFileSize|maximum size]]. Log rotation is enabled by default. This property allows you to disable it, when you have configured an external tools for log rotation on your server

Tags
since
2.0.3

$logVars

public array<string|int, mixed> $logVars = ['_GET', '_POST', '_FILES', '_COOKIE', '_SESSION']

list of the PHP predefined variables that should be logged in a message. Note that a variable must be accessible via $GLOBALS. Otherwise it won't be logged

Methods

export()

Writes log messages to a file.

public export() : mixed
Tags
throws
InvalidConfigException

if unable to open the log file for writing

Return values
mixed

formatMessage()

Formats a log message for display as a string.

public formatMessage(array<string|int, mixed> $message) : string
Parameters
$message : array<string|int, mixed>

the log message to be formatted. The message structure follows that in [[Logger::messages]]

Return values
string

the formatted message

init()

Initializes the route.

public init() : mixed

This method is invoked after the route is created by the route manager.

Return values
mixed

getContextMessage()

Generates the context information to be logged.

protected getContextMessage() : string

The default implementation will dump user information, system variables, etc.

Return values
string

the context information. If an empty string, it means no context information


        

Search results