MonologTarget ​
- Type
- Class
- Namespace
- craft\log
- Inherits
- craft\log\MonologTarget »
samdark\log\PsrTarget
- Since
- 4.0.0
Class MonologTarget
Public Properties ​
Property | Description |
---|---|
contextMessage | string |
except | |
logContext | boolean – Whether to log request context |
contextMessage
​
- Type
- string
- Default value
null
except
​
- Default value
[ \yii\i18n\PhpMessageSource::class . ':*', \yii\web\HttpException::class . ':404', ]
logContext
​
- Type
- boolean
- Default value
true
Whether to log request context
Protected Properties ​
Property | Description |
---|---|
allowLineBreaks | boolean |
formatter | \Monolog\Formatter\FormatterInterface , null – The Monolog formatter to use. |
level | string – The PSR-3 log level to use. |
maxFiles | integer – The maximum number of files to keep in rotation. |
name | string |
processor | \Monolog\Processor\ProcessorInterface , null – The Monolog processor to use. |
useMicrosecondTimestamps | boolean |
allowLineBreaks
​
- Type
- boolean
- Default value
false
formatter
​
- Type
\Monolog\Formatter\FormatterInterface
, null- Default value
null
The Monolog formatter to use. Defaults to LineFormatter
.
level
​
- Type
- string
- Default value
\Psr\Log\LogLevel::WARNING
The PSR-3 log level to use.
maxFiles
​
- Type
- integer
- Default value
5
The maximum number of files to keep in rotation.
See also \Monolog\Handler\RotatingFileHandler::$maxFiles
name
​
- Type
- string
- Default value
null
See also \Monolog\Logger::$name
processor
​
- Type
\Monolog\Processor\ProcessorInterface
, null- Default value
null
The Monolog processor to use. Defaults to PsrLogMessageProcessor
.
useMicrosecondTimestamps
​
- Type
- boolean
- Default value
false
See also \Monolog\Logger::useMicrosecondTimestamps
Public Methods ​
Method | Description |
---|---|
__construct() | |
export() | Log additional request context. |
getAllowLineBreaks() | Returns whether the log target should allow line breaks. |
getFormatter() | Returns the log formatter. |
getLevel() | Returns the log level. |
getLogger() | |
getMaxFiles() | Returns the maximum number of log files to store. |
getName() | Returns the log target’s name. |
getProcessor() | Returns the log processor. |
getUseMicrosecondTimestamps() | Returns whether logs should show microseconds in timestamps. |
setAllowLineBreaks() | Sets whether the log target should allow line breaks. |
setFormatter() | Sets the log formatter. |
setLevel() | Sets the log level. |
setLogger() | |
setMaxFiles() | Sets the maximum number of log files to store. |
setName() | |
setProcessor() | Sets the log processor. |
setUseMicrosecondTimestamps() | Sets whether logs should show microseconds in timestamps. |
__construct()
​
Arguments ​
$config
export()
​
Log additional request context.
getAllowLineBreaks()
​
- Since
- 4.13.0
Returns whether the log target should allow line breaks.
Returns ​
getFormatter()
​
- Since
- 4.13.0
Returns the log formatter.
Returns ​
\Monolog\Formatter\FormatterInterface
, null
getLevel()
​
- Since
- 4.13.0
Returns the log level.
Returns ​
getLogger()
​
Returns ​
\Monolog\Logger
getMaxFiles()
​
- Since
- 4.13.0
Returns the maximum number of log files to store.
Returns ​
getName()
​
- Since
- 4.13.0
Returns the log target’s name.
Returns ​
getProcessor()
​
- Since
- 4.13.0
Returns the log processor.
Returns ​
\Monolog\Processor\ProcessorInterface
, null
getUseMicrosecondTimestamps()
​
- Since
- 4.13.0
Returns whether logs should show microseconds in timestamps.
Returns ​
setAllowLineBreaks()
​
Sets whether the log target should allow line breaks.
Arguments ​
$allowLineBreaks
(boolean)
Throws ​
setFormatter()
​
Sets the log formatter.
Arguments ​
$formatter
(\Monolog\Formatter\FormatterInterface
, null)
Throws ​
setLevel()
​
Sets the log level.
Arguments ​
Throws ​
setLogger()
​
Arguments ​
$logger
Throws ​
setMaxFiles()
​
Sets the maximum number of log files to store.
Arguments ​
$maxFiles
(integer)
Throws ​
setName()
​
Arguments ​
$name
(string)
Throws ​
setProcessor()
​
Sets the log processor.
Arguments ​
$processor
(\Monolog\Processor\ProcessorInterface
, null)
Throws ​
setUseMicrosecondTimestamps()
​
Sets whether logs should show microseconds in timestamps.
Arguments ​
$useMicrosecondTimestamps
(boolean)
Throws ​
Protected Methods ​
Method | Description |
---|---|
getContextMessage() | Context is logged via {@see self::export} method, so it can be added using Monolog. |
getContextMessage()
​
Context is logged via {@see self::export} method, so it can be added using Monolog.