Documentation

Log extends Logger
in package

Logger class.

Table of Contents

$levelMap  : mixed
$logsViewerColumnMapping  : array<string|int, mixed>
Column mapping by table for logs viewer.
$logToConsole  : mixed
$logToFile  : mixed
$logToLevels  : mixed
$logToProfile  : mixed
$owaspColumnMapping  : array<string|int, mixed>
Column mapping by table for logs owasp.
beginProfile()  : mixed
Marks the beginning of a code block for profiling.
endProfile()  : mixed
Marks the end of a code block for profiling.
error()  : mixed
Logs an error message.
getlastLogs()  : string
Get last logs.
getLogs()  : array<string|int, mixed>
Get user action logs.
info()  : mixed
Logs an informative message.
init()  : mixed
Initializes the logger by registering [[flush()]] as a shutdown function.
log()  : mixed
Logs a message with the given type and category.
setLevels()  : mixed
Sets the message levels that this target is interested in.
trace()  : mixed
Logs a trace message.
warning()  : mixed
Logs a warning message.

Properties

$levelMap

public static mixed $levelMap = ['error' => \yii\log\Logger::LEVEL_ERROR, 'warning' => \yii\log\Logger::LEVEL_WARNING, 'info' => \yii\log\Logger::LEVEL_INFO, 'trace' => \yii\log\Logger::LEVEL_TRACE, 'profile' => \yii\log\Logger::LEVEL_PROFILE]

$logsViewerColumnMapping

Column mapping by table for logs viewer.

public static array<string|int, mixed> $logsViewerColumnMapping = ['magento' => ['label' => 'LBL_MAGENTO', 'labelModule' => 'Settings:Magento', 'table' => 'l_#__magento', 'icon' => 'yfi-magento', 'columns' => ['time' => ['type' => 'DateTime', 'label' => 'LBL_TIME'], 'category' => ['type' => 'Text', 'label' => 'LBL_CATEGORY'], 'message' => ['type' => 'Text', 'label' => 'LBL_MESSAGE'], 'code' => ['type' => 'Text', 'label' => 'LBL_CODE'], 'trace' => ['type' => 'Text', 'label' => 'LBL_BACKTRACE']], 'filter' => ['time' => 'DateTimeRange', 'category' => 'Text', 'message' => 'Text', 'code' => 'Text', 'trace' => 'Text']], 'wapro' => ['label' => 'LBL_WAPRO_ERP', 'labelModule' => 'Settings:Wapro', 'table' => 'l_#__wapro', 'icon' => 'fab fa-connectdevelop', 'columns' => ['time' => ['type' => 'DateTime', 'label' => 'LBL_TIME'], 'category' => ['type' => 'Text', 'label' => 'LBL_CATEGORY'], 'message' => ['type' => 'Text', 'label' => 'LBL_MESSAGE'], 'error' => ['type' => 'Text', 'label' => 'LBL_CODE'], 'trace' => ['type' => 'Text', 'label' => 'LBL_BACKTRACE']], 'filter' => ['time' => 'DateTimeRange', 'category' => 'Text', 'message' => 'Text', 'code' => 'Text', 'trace' => 'Text']], 'switchUsers' => ['label' => 'LBL_SWITCH_USERS', 'labelModule' => 'Settings:Users', 'table' => 'l_#__switch_users', 'icon' => 'yfi-users', 'columns' => ['date' => ['type' => 'DateTime', 'label' => 'LBL_TIME'], 'status' => ['type' => 'Text', 'label' => 'LBL_STATUS'], 'busername' => ['type' => 'Text', 'label' => 'LBL_BASE_USER'], 'dusername' => ['type' => 'Text', 'label' => 'LBL_DEST_USER'], 'ip' => ['type' => 'Text', 'label' => 'LBL_IP_ADDRESS'], 'agent' => ['type' => 'Text', 'label' => 'LBL_USER_AGENT']], 'filter' => ['date' => 'DateTimeRange', 'busername' => 'Text', 'dusername' => 'Text', 'ip' => 'Text', 'agent' => 'Text']], 'batchMethod' => ['label' => 'LBL_BATCH_METHODS', 'labelModule' => 'Settings:CronTasks', 'table' => 'l_#__batchmethod', 'icon' => 'fas fa-swatchbook', 'columns' => ['date' => ['type' => 'DateTime', 'label' => 'LBL_TIME'], 'method' => ['type' => 'Text', 'label' => 'LBL_BATCH_NAME'], 'message' => ['type' => 'Text', 'label' => 'LBL_ERROR_MASAGE'], 'userid' => ['type' => 'Owner', 'label' => 'LBL_OWNER'], 'params' => ['type' => 'Text', 'label' => 'LBL_PARAMS']], 'filter' => ['date' => 'DateTimeRange', 'method' => 'Text', 'message' => 'Text', 'params' => 'Text']], 'mail' => ['label' => 'LBL_MAILS_NOT_SENT', 'labelModule' => 'Settings:Log', 'table' => 'l_#__mail', 'icon' => 'adminIcon-mail-queue', 'columns' => ['date' => ['type' => 'DateTime', 'label' => 'LBL_TIME'], 'subject' => ['type' => 'Text', 'label' => 'LBL_SUBJECT'], 'from' => ['type' => 'Text', 'label' => 'LBL_FROM'], 'to' => ['type' => 'Text', 'label' => 'LBL_TO'], 'owner' => ['type' => 'Owner', 'label' => 'LBL_OWNER']], 'filter' => ['date' => 'DateTimeRange', 'subject' => 'Text', 'from' => 'Text', 'to' => 'Text']], 'profile' => ['label' => 'LBL_PROFILING', 'labelModule' => 'Settings:Log', 'table' => 'l_#__profile', 'icon' => 'fas fa-stopwatch', 'columns' => ['category' => ['type' => 'Text', 'label' => 'Category'], 'info' => ['type' => 'Text', 'label' => 'LBL_PARAMS'], 'log_time' => ['type' => 'Text', 'label' => 'LBL_TIME'], 'trace' => ['type' => 'Text', 'label' => 'LBL_BACKTRACE'], 'duration' => ['type' => 'Text', 'label' => 'LBL_DURATION']], 'filter' => ['category' => 'Text', 'subinfoject' => 'Text', 'log_time' => 'Text', 'trace' => 'Text', 'duration' => 'Text']]]

$logToConsole

public static mixed $logToConsole

$logToFile

public static mixed $logToFile

$logToLevels

public mixed $logToLevels = 0

$logToProfile

public static mixed $logToProfile

$owaspColumnMapping

Column mapping by table for logs owasp.

public static array<string|int, mixed> $owaspColumnMapping = ['access_for_admin' => ['date', 'username', 'ip', 'module', 'url', 'agent', 'request', 'referer'], 'access_for_api' => ['date', 'username', 'ip', 'url', 'agent', 'request'], 'access_for_user' => ['date', 'username', 'ip', 'module', 'url', 'agent', 'request', 'referer'], 'access_to_record' => ['date', 'username', 'ip', 'module', 'record', 'url', 'agent', 'request', 'referer'], 'csrf' => ['date', 'username', 'ip', 'referer', 'url', 'agent']]

Methods

beginProfile()

Marks the beginning of a code block for profiling.

public static beginProfile(string $token[, string $category = '' ]) : mixed

This has to be matched with a call to [[endProfile]] with the same category name. The begin- and end- calls must also be properly nested. For example,.

\Yii::beginProfile('block1');
// some code to be profiled
    \Yii::beginProfile('block2');
    // some other code to be profiled
    \Yii::endProfile('block2');
\Yii::endProfile('block1');
Parameters
$token : string

token for the code block

$category : string = ''

the category of this log message

Tags
see
endProfile()
Return values
mixed

endProfile()

Marks the end of a code block for profiling.

public static endProfile(string $token[, string $category = '' ]) : mixed

This has to be matched with a previous call to [[beginProfile]] with the same category name.

Parameters
$token : string

token for the code block

$category : string = ''

the category of this log message

Tags
see
beginProfile()
Return values
mixed

error()

Logs an error message.

public static error(string $message[, string $category = '' ]) : mixed

An error message is typically logged when an unrecoverable error occurs during the execution of an application.

Parameters
$message : string

the message to be logged

$category : string = ''

the category of the message

Return values
mixed

getlastLogs()

Get last logs.

public static getlastLogs([bool|array<string|int, string> $types = false ]) : string
Parameters
$types : bool|array<string|int, string> = false
Return values
string

getLogs()

Get user action logs.

public static getLogs(string $type, string $mode[, bool $countMode = false ]) : array<string|int, mixed>
Parameters
$type : string
$mode : string
$countMode : bool = false
Return values
array<string|int, mixed>

info()

Logs an informative message.

public static info(string $message[, string $category = '' ]) : mixed

An informative message is typically logged by an application to keep record of something important (e.g. an administrator logs in).

Parameters
$message : string

the message to be logged

$category : string = ''

the category of the message

Return values
mixed

init()

Initializes the logger by registering [[flush()]] as a shutdown function.

public init() : mixed
Return values
mixed

log()

Logs a message with the given type and category.

public log(array<string|int, mixed>|string $message, int $level[, string $category = '' ]) : mixed

If [[traceLevel]] is greater than 0, additional call stack information about the application code will be logged as well.

Parameters
$message : array<string|int, mixed>|string

the message to be logged. This can be a simple string or a more complex data structure that will be handled by a [[Target|log target]]

$level : int

the level of the message. This must be one of the following: Logger::LEVEL_ERROR, Logger::LEVEL_WARNING, Logger::LEVEL_INFO, Logger::LEVEL_TRACE, Logger::LEVEL_PROFILE_BEGIN, Logger::LEVEL_PROFILE_END

$category : string = ''

the category of the message

Return values
mixed

setLevels()

Sets the message levels that this target is interested in.

public setLevels(array<string|int, mixed>|int $levels) : mixed
Parameters
$levels : array<string|int, mixed>|int

message levels that this target is interested in.

Return values
mixed

trace()

Logs a trace message.

public static trace(string $message[, string $category = '' ]) : mixed

Trace messages are logged mainly for development purpose to see the execution work flow of some code.

Parameters
$message : string

the message to be logged

$category : string = ''

the category of the message

Return values
mixed

warning()

Logs a warning message.

public static warning(string $message[, string $category = '' ]) : mixed

A warning message is typically logged when an error occurs while the execution can still continue.

Parameters
$message : string

the message to be logged

$category : string = ''

the category of the message

Return values
mixed

        

Search results