class Writer (View source)

Properties

protected Logger $monolog The Monolog logger instance.
protected array $levels All of the error levels.
protected Dispatcher $dispatcher The event dispatcher instance.

Methods

void
__construct(Logger $monolog, Dispatcher $dispatcher = null)

Create a new log writer instance.

mixed
callMonolog(string $method, mixed $parameters)

Call Monolog with the given method and parameters.

void
useFiles(string $path, string $level = 'debug')

Register a file log handler.

void
useDailyFiles(string $path, int $days, string $level = 'debug')

Register a daily file log handler.

void
useErrorLog(string $level = 'debug', int $messageType = ErrorLogHandler::OPERATING_SYSTEM)

Register an error_log handler.

LineFormatter
getDefaultFormatter()

Get a default Monolog formatter instance.

int
parseLevel(string $level)

Parse the string level into a Monolog constant.

void
listen(Closure $callback)

Register a new callback handler for when a log event is triggered.

Logger
getMonolog()

Get the underlying Monolog instance.

getEventDispatcher()

Get the event dispatcher instance.

void
setEventDispatcher(Dispatcher $dispatcher)

Set the event dispatcher instance.

void
fireLogEvent(string $level, string $message, array $context = array())

Fires a log event.

mixed
write()

Dynamically pass log calls into the writer.

mixed
__call(string $method, mixed $parameters)

Dynamically handle error additions.

void
formatParameters(mixed $parameters)

Format the parameters for the logger.

Details

void __construct(Logger $monolog, Dispatcher $dispatcher = null)

Create a new log writer instance.

Parameters

Logger $monolog
Dispatcher $dispatcher

Return Value

void

protected mixed callMonolog(string $method, mixed $parameters)

Call Monolog with the given method and parameters.

Parameters

string $method
mixed $parameters

Return Value

mixed

void useFiles(string $path, string $level = 'debug')

Register a file log handler.

Parameters

string $path
string $level

Return Value

void

void useDailyFiles(string $path, int $days, string $level = 'debug')

Register a daily file log handler.

Parameters

string $path
int $days
string $level

Return Value

void

void useErrorLog(string $level = 'debug', int $messageType = ErrorLogHandler::OPERATING_SYSTEM)

Register an error_log handler.

Parameters

string $level
int $messageType

Return Value

void

protected LineFormatter getDefaultFormatter()

Get a default Monolog formatter instance.

Return Value

LineFormatter

protected int parseLevel(string $level)

Parse the string level into a Monolog constant.

Parameters

string $level

Return Value

int

Exceptions

InvalidArgumentException

void listen(Closure $callback)

Register a new callback handler for when a log event is triggered.

Parameters

Closure $callback

Return Value

void

Exceptions

RuntimeException

Logger getMonolog()

Get the underlying Monolog instance.

Return Value

Logger

Dispatcher getEventDispatcher()

Get the event dispatcher instance.

Return Value

Dispatcher

void setEventDispatcher(Dispatcher $dispatcher)

Set the event dispatcher instance.

Parameters

Dispatcher $dispatcher

Return Value

void

protected void fireLogEvent(string $level, string $message, array $context = array())

Fires a log event.

Parameters

string $level
string $message
array $context

Return Value

void

mixed write()

Dynamically pass log calls into the writer.

Return Value

mixed

mixed __call(string $method, mixed $parameters)

Dynamically handle error additions.

Parameters

string $method
mixed $parameters

Return Value

mixed

Exceptions

BadMethodCallException

protected void formatParameters(mixed $parameters)

Format the parameters for the logger.

Parameters

mixed $parameters

Return Value

void