Documentation

ConsoleFormatter
in package
implements FormatterInterface

Formats incoming records for console output by coloring them depending on log level.

Tags
author

Tobias Schultze http://tobion.de

author

Grégoire Pineau lyrixx@lyrixx.info

Interfaces, Classes and Traits

FormatterInterface
Interface for formatters

Table of Contents

SIMPLE_DATE  = 'H:i:s'
SIMPLE_FORMAT  = "%datetime% %start_tag%%level_name%%end_tag% <comment>[%channel%]</> %message%%context%%extra% "
LEVEL_COLOR_MAP  = [MonologLogger::DEBUG => 'fg=white', MonologLogger::INFO => 'fg=green', MonologLogger::NOTICE => 'fg=blue', MonologLogger::WARNING => 'fg=cyan', MonologLogger::ERROR => 'fg=yellow', MonologLogger::CRITICAL => 'fg=red', MonologLogger::ALERT => 'fg=red', MonologLogger::EMERGENCY => 'fg=white;bg=red']
$cloner  : mixed
$dumper  : mixed
$options  : mixed
$outputBuffer  : mixed
__construct()  : mixed
Available options: * format: The format of the outputted log string. The following placeholders are supported: %datetime%, %start_tag%, %level_name%, %end_tag%, %channel%, %message%, %context%, %extra%; * date_format: The format of the outputted date string; * colors: If true, the log string contains ANSI code to add color; * multiline: If false, "context" and "extra" are dumped on one line.
format()  : mixed
Formats a log record.
formatBatch()  : mixed
Formats a set of log records.
dumpData()  : string
replacePlaceHolder()  : array<string|int, mixed>

Constants

SIMPLE_FORMAT

public mixed SIMPLE_FORMAT = "%datetime% %start_tag%%level_name%%end_tag% <comment>[%channel%]</> %message%%context%%extra% "

LEVEL_COLOR_MAP

private mixed LEVEL_COLOR_MAP = [MonologLogger::DEBUG => 'fg=white', MonologLogger::INFO => 'fg=green', MonologLogger::NOTICE => 'fg=blue', MonologLogger::WARNING => 'fg=cyan', MonologLogger::ERROR => 'fg=yellow', MonologLogger::CRITICAL => 'fg=red', MonologLogger::ALERT => 'fg=red', MonologLogger::EMERGENCY => 'fg=white;bg=red']

Properties

Methods

__construct()

Available options: * format: The format of the outputted log string. The following placeholders are supported: %datetime%, %start_tag%, %level_name%, %end_tag%, %channel%, %message%, %context%, %extra%; * date_format: The format of the outputted date string; * colors: If true, the log string contains ANSI code to add color; * multiline: If false, "context" and "extra" are dumped on one line.

public __construct([array<string|int, mixed> $options = [] ]) : mixed
Parameters
$options : array<string|int, mixed> = []
Return values
mixed

format()

Formats a log record.

public format(array<string|int, mixed> $record) : mixed
Parameters
$record : array<string|int, mixed>

A record to format

Return values
mixed

formatBatch()

Formats a set of log records.

public formatBatch(array<string|int, mixed> $records) : mixed
Parameters
$records : array<string|int, mixed>

A set of records to format

Return values
mixed

dumpData()

private dumpData(mixed $data[, bool|null $colors = null ]) : string
Parameters
$data : mixed
$colors : bool|null = null
Return values
string

replacePlaceHolder()

private replacePlaceHolder(array<string|int, mixed> $record) : array<string|int, mixed>
Parameters
$record : array<string|int, mixed>
Return values
array<string|int, mixed>

Search results