class Writer implements Log, LoggerInterface

Properties

protected Logger $monolog

The Monolog logger instance.

protected Dispatcher $dispatcher

The event dispatcher instance.

protected array $levels

The Log levels.

Methods

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

Create a new log writer instance.

void
emergency(string $message, array $context = [])

Log an emergency message to the logs.

void
alert(string $message, array $context = [])

Log an alert message to the logs.

void
critical(string $message, array $context = [])

Log a critical message to the logs.

void
error(string $message, array $context = [])

Log an error message to the logs.

void
warning(string $message, array $context = [])

Log a warning message to the logs.

void
notice(string $message, array $context = [])

Log a notice to the logs.

void
info(string $message, array $context = [])

Log an informational message to the logs.

void
debug(string $message, array $context = [])

Log a debug message to the logs.

void
log(string $level, string $message, array $context = [])

Log a message to the logs.

void
write(string $level, string $message, array $context = [])

Dynamically pass log calls into the writer.

void
writeLog(string $level, string $message, array $context)

Write a message to Monolog.

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

Register a file log handler.

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

Register a daily file log handler.

LoggerInterface
useSyslog(string $name = 'laravel', string $level = 'debug', mixed $facility = LOG_USER)

Register a Syslog handler.

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

Register an error_log handler.

void
listen(Closure $callback)

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

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

Fires a log event.

mixed
formatMessage(mixed $message)

Format the parameters for the logger.

int
parseLevel(string $level)

Parse the string level into a Monolog constant.

Logger
getMonolog()

Get the underlying Monolog instance.

LineFormatter
getDefaultFormatter()

Get a default Monolog formatter instance.

getEventDispatcher()

Get the event dispatcher instance.

void
setEventDispatcher(Dispatcher $dispatcher)

Set the event dispatcher instance.

Details

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

Create a new log writer instance.

Parameters

Logger $monolog
Dispatcher $dispatcher

Return Value

void

at line 76
void emergency(string $message, array $context = [])

Log an emergency message to the logs.

Parameters

string $message
array $context

Return Value

void

at line 88
void alert(string $message, array $context = [])

Log an alert message to the logs.

Parameters

string $message
array $context

Return Value

void

at line 100
void critical(string $message, array $context = [])

Log a critical message to the logs.

Parameters

string $message
array $context

Return Value

void

at line 112
void error(string $message, array $context = [])

Log an error message to the logs.

Parameters

string $message
array $context

Return Value

void

at line 124
void warning(string $message, array $context = [])

Log a warning message to the logs.

Parameters

string $message
array $context

Return Value

void

at line 136
void notice(string $message, array $context = [])

Log a notice to the logs.

Parameters

string $message
array $context

Return Value

void

at line 148
void info(string $message, array $context = [])

Log an informational message to the logs.

Parameters

string $message
array $context

Return Value

void

at line 160
void debug(string $message, array $context = [])

Log a debug message to the logs.

Parameters

string $message
array $context

Return Value

void

at line 173
void log(string $level, string $message, array $context = [])

Log a message to the logs.

Parameters

string $level
string $message
array $context

Return Value

void

at line 186
void write(string $level, string $message, array $context = [])

Dynamically pass log calls into the writer.

Parameters

string $level
string $message
array $context

Return Value

void

at line 199
protected void writeLog(string $level, string $message, array $context)

Write a message to Monolog.

Parameters

string $level
string $message
array $context

Return Value

void

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

Register a file log handler.

Parameters

string $path
string $level

Return Value

void

at line 228
void useDailyFiles(string $path, int $days = 0, string $level = 'debug')

Register a daily file log handler.

Parameters

string $path
int $days
string $level

Return Value

void

at line 245
LoggerInterface useSyslog(string $name = 'laravel', string $level = 'debug', mixed $facility = LOG_USER)

Register a Syslog handler.

Parameters

string $name
string $level
mixed $facility

Return Value

LoggerInterface

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

Register an error_log handler.

Parameters

string $level
int $messageType

Return Value

void

at line 274
void listen(Closure $callback)

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

Parameters

Closure $callback

Return Value

void

Exceptions

RuntimeException

at line 291
protected void fireLogEvent(string $level, string $message, array $context = [])

Fires a log event.

Parameters

string $level
string $message
array $context

Return Value

void

at line 307
protected mixed formatMessage(mixed $message)

Format the parameters for the logger.

Parameters

mixed $message

Return Value

mixed

at line 328
protected int parseLevel(string $level)

Parse the string level into a Monolog constant.

Parameters

string $level

Return Value

int

Exceptions

InvalidArgumentException

at line 342
Logger getMonolog()

Get the underlying Monolog instance.

Return Value

Logger

at line 352
protected LineFormatter getDefaultFormatter()

Get a default Monolog formatter instance.

Return Value

LineFormatter

at line 362
Dispatcher getEventDispatcher()

Get the event dispatcher instance.

Return Value

Dispatcher

at line 373
void setEventDispatcher(Dispatcher $dispatcher)

Set the event dispatcher instance.

Parameters

Dispatcher $dispatcher

Return Value

void