Skip to content

MonologTarget ​

Type
Class
Namespace
craft\log
Inherits
craft\log\MonologTarget » samdark\log\PsrTarget
Since
4.0.0

Class MonologTarget

View source

Public Properties ​

PropertyDescription
contextMessagestring
except
logContextboolean – Whether to log request context

contextMessage ​

Type
string
Default value
null

View source

except ​

Default value
[ \yii\i18n\PhpMessageSource::class . ':*', \yii\web\HttpException::class . ':404', ]

View source

logContext ​

Type
boolean
Default value
true

Whether to log request context

View source

Protected Properties ​

PropertyDescription
allowLineBreaksboolean
formatter\Monolog\Formatter\FormatterInterface, null – The Monolog formatter to use.
levelstring – The PSR-3 log level to use.
maxFilesinteger – The maximum number of files to keep in rotation.
namestring
processor\Monolog\Processor\ProcessorInterface, null – The Monolog processor to use.
useMicrosecondTimestampsboolean

allowLineBreaks ​

Type
boolean
Default value
false

View source

formatter ​

Type
\Monolog\Formatter\FormatterInterface, null
Default value
null

The Monolog formatter to use. Defaults to LineFormatter.

View source

level ​

Type
string
Default value
\Psr\Log\LogLevel::WARNING

The PSR-3 log level to use.

View source

maxFiles ​

Type
integer
Default value
5

The maximum number of files to keep in rotation.

See also \Monolog\Handler\RotatingFileHandler::$maxFiles

View source

name ​

Type
string
Default value
null

See also \Monolog\Logger::$name

View source

processor ​

Type
\Monolog\Processor\ProcessorInterface, null
Default value
null

The Monolog processor to use. Defaults to PsrLogMessageProcessor.

View source

useMicrosecondTimestamps ​

Type
boolean
Default value
false

See also \Monolog\Logger::useMicrosecondTimestamps

View source

Public Methods ​

MethodDescription
__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() ​

View source

Arguments ​

  • $config

export() ​

Log additional request context.

View source

getAllowLineBreaks() ​

Since
4.13.0

Returns whether the log target should allow line breaks.

View source

Returns ​

boolean

getFormatter() ​

Since
4.13.0

Returns the log formatter.

View source

Returns ​

\Monolog\Formatter\FormatterInterface, null

getLevel() ​

Since
4.13.0

Returns the log level.

View source

Returns ​

string

getLogger() ​

View source

Returns ​

\Monolog\Logger

getMaxFiles() ​

Since
4.13.0

Returns the maximum number of log files to store.

View source

Returns ​

integer

getName() ​

Since
4.13.0

Returns the log target’s name.

View source

Returns ​

string

getProcessor() ​

Since
4.13.0

Returns the log processor.

View source

Returns ​

\Monolog\Processor\ProcessorInterface, null

getUseMicrosecondTimestamps() ​

Since
4.13.0

Returns whether logs should show microseconds in timestamps.

View source

Returns ​

boolean

setAllowLineBreaks() ​

Sets whether the log target should allow line breaks.

View source

Arguments ​

Throws ​

setFormatter() ​

Sets the log formatter.

View source

Arguments ​

  • $formatter (\Monolog\Formatter\FormatterInterface, null)

Throws ​

setLevel() ​

Sets the log level.

View source

Arguments ​

Throws ​

setLogger() ​

View source

Arguments ​

  • $logger

Throws ​

setMaxFiles() ​

Sets the maximum number of log files to store.

View source

Arguments ​

Throws ​

setName() ​

View source

Arguments ​

Throws ​

setProcessor() ​

Sets the log processor.

View source

Arguments ​

  • $processor (\Monolog\Processor\ProcessorInterface, null)

Throws ​

setUseMicrosecondTimestamps() ​

Sets whether logs should show microseconds in timestamps.

View source

Arguments ​

  • $useMicrosecondTimestamps (boolean)

Throws ​

Protected Methods ​

MethodDescription
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.

View source