class Illuminate / Log / Logger
You're browsing the documentation for an upcoming version of Laravel. The documentation and features of this release are subject to change.

Logger

Implements

  • Psr\...\LoggerInterface

Uses

Properties

protected

$logger Psr\...\LoggerInterface

The underlying logger implementation.

Default: null
protected

$dispatcher Dispatcher |null

The event dispatcher instance.

Default: null
protected

$context array

Any context to be added to logs.

Default: []

Methods

public

__construct ( Psr\...\LoggerInterface $logger , Dispatcher $dispatcher ) : void

Create a new log writer instance.

Parameters

  • $logger Psr\...\LoggerInterface
  • $dispatcher Dispatcher |null
public

emergency ( $message , array $context ) : void

Log an emergency message to the logs.

Parameters

public

alert ( $message , array $context ) : void

Log an alert message to the logs.

Parameters

public

critical ( $message , array $context ) : void

Log a critical message to the logs.

Parameters

public

error ( $message , array $context ) : void

Log an error message to the logs.

Parameters

public

warning ( $message , array $context ) : void

Log a warning message to the logs.

Parameters

public

notice ( $message , array $context ) : void

Log a notice to the logs.

Parameters

public

info ( $message , array $context ) : void

Log an informational message to the logs.

Parameters

public

debug ( $message , array $context ) : void

Log a debug message to the logs.

Parameters

public

log ( $level , $message , array $context ) : void

Log a message to the logs.

Parameters

public

write ( $level , $message , array $context ) : void

Dynamically pass log calls into the writer.

Parameters

protected

writeLog ( $level , $message , $context ) : void

Write a message to the log.

Parameters

public

withContext ( array $context ) : $this

Add context to all future logs.

Parameters

  • $context array
public

withoutContext ( ) : $this

Flush the existing context array.

public

listen ( Closure $callback ) : void

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

Parameters

protected

fireLogEvent ( $level , $message , array $context ) : void

Fires a log event.

Parameters

  • $level string
  • $message string
  • $context array
protected

formatMessage ( $message ) : string

Format the parameters for the logger.

Parameters

public

getLogger ( ) : Psr\...\LoggerInterface

Get the underlying logger implementation.

public

getEventDispatcher ( ) : Dispatcher

Get the event dispatcher instance.

public

setEventDispatcher ( Dispatcher $dispatcher ) : void

Set the event dispatcher instance.

Parameters

public

__call ( $method , $parameters ) : mixed

Dynamically proxy method calls to the underlying logger.

Parameters

  • $method string
  • $parameters array