BlueSpice MediaWiki REL1_27
 All Classes Namespaces Files Functions Variables Groups Pages
Monolog\Logger Class Reference
Inheritance diagram for Monolog\Logger:
Collaboration diagram for Monolog\Logger:

Public Member Functions

 __construct ($name, array $handlers=array(), array $processors=array())
 
 getName ()
 
 withName ($name)
 
 pushHandler (HandlerInterface $handler)
 
 popHandler ()
 
 setHandlers (array $handlers)
 
 getHandlers ()
 
 pushProcessor ($callback)
 
 popProcessor ()
 
 getProcessors ()
 
 useMicrosecondTimestamps ($micro)
 
 addRecord ($level, $message, array $context=array())
 
 addDebug ($message, array $context=array())
 
 addInfo ($message, array $context=array())
 
 addNotice ($message, array $context=array())
 
 addWarning ($message, array $context=array())
 
 addError ($message, array $context=array())
 
 addCritical ($message, array $context=array())
 
 addAlert ($message, array $context=array())
 
 addEmergency ($message, array $context=array())
 
 isHandling ($level)
 
 log ($level, $message, array $context=array())
 
 debug ($message, array $context=array())
 
 info ($message, array $context=array())
 
 notice ($message, array $context=array())
 
 warn ($message, array $context=array())
 
 warning ($message, array $context=array())
 
 err ($message, array $context=array())
 
 error ($message, array $context=array())
 
 crit ($message, array $context=array())
 
 critical ($message, array $context=array())
 
 alert ($message, array $context=array())
 
 emerg ($message, array $context=array())
 
 emergency ($message, array $context=array())
 

Static Public Member Functions

static getLevels ()
 
static getLevelName ($level)
 
static toMonologLevel ($level)
 
static setTimezone (\DateTimeZone $tz)
 

Public Attributes

const DEBUG = 100
 
const INFO = 200
 
const NOTICE = 250
 
const WARNING = 300
 
const ERROR = 400
 
const CRITICAL = 500
 
const ALERT = 550
 
const EMERGENCY = 600
 
const API = 1
 

Protected Attributes

 $name
 
 $handlers
 
 $processors
 
 $microsecondTimestamps = true
 

Static Protected Attributes

static $levels
 
static $timezone
 

Detailed Description

Monolog log channel

It contains a stack of Handlers and a stack of Processors, and uses them to store records that are added to it.

Author
Jordi Boggiano j.bog.nosp@m.gian.nosp@m.o@sel.nosp@m.d.be

Constructor & Destructor Documentation

Monolog\Logger::__construct (   $name,
array  $handlers = array(),
array  $processors = array() 
)
Parameters
string$nameThe logging channel
HandlerInterface[]$handlers Optional stack of handlers, the first one in the array is called first, etc.
callable[]$processors Optional array of processors

Member Function Documentation

Monolog\Logger::addAlert (   $message,
array  $context = array() 
)

Adds a log record at the ALERT level.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed
Monolog\Logger::addCritical (   $message,
array  $context = array() 
)

Adds a log record at the CRITICAL level.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed
Monolog\Logger::addDebug (   $message,
array  $context = array() 
)

Adds a log record at the DEBUG level.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed
Monolog\Logger::addEmergency (   $message,
array  $context = array() 
)

Adds a log record at the EMERGENCY level.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed
Monolog\Logger::addError (   $message,
array  $context = array() 
)

Adds a log record at the ERROR level.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed
Monolog\Logger::addInfo (   $message,
array  $context = array() 
)

Adds a log record at the INFO level.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed
Monolog\Logger::addNotice (   $message,
array  $context = array() 
)

Adds a log record at the NOTICE level.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed
Monolog\Logger::addRecord (   $level,
  $message,
array  $context = array() 
)

Adds a log record.

Parameters
int$levelThe logging level
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed
Monolog\Logger::addWarning (   $message,
array  $context = array() 
)

Adds a log record at the WARNING level.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed
Monolog\Logger::alert (   $message,
array  $context = array() 
)

Adds a log record at the ALERT level.

This method allows for compatibility with common interfaces.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed

Implements Psr\Log\LoggerInterface.

Monolog\Logger::crit (   $message,
array  $context = array() 
)

Adds a log record at the CRITICAL level.

This method allows for compatibility with common interfaces.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed
Monolog\Logger::critical (   $message,
array  $context = array() 
)

Adds a log record at the CRITICAL level.

This method allows for compatibility with common interfaces.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed

Implements Psr\Log\LoggerInterface.

Monolog\Logger::debug (   $message,
array  $context = array() 
)

Adds a log record at the DEBUG level.

This method allows for compatibility with common interfaces.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed

Implements Psr\Log\LoggerInterface.

Monolog\Logger::emerg (   $message,
array  $context = array() 
)

Adds a log record at the EMERGENCY level.

This method allows for compatibility with common interfaces.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed
Monolog\Logger::emergency (   $message,
array  $context = array() 
)

Adds a log record at the EMERGENCY level.

This method allows for compatibility with common interfaces.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed

Implements Psr\Log\LoggerInterface.

Monolog\Logger::err (   $message,
array  $context = array() 
)

Adds a log record at the ERROR level.

This method allows for compatibility with common interfaces.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed
Monolog\Logger::error (   $message,
array  $context = array() 
)

Adds a log record at the ERROR level.

This method allows for compatibility with common interfaces.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed

Implements Psr\Log\LoggerInterface.

Monolog\Logger::getHandlers ( )
Returns
HandlerInterface[]
static Monolog\Logger::getLevelName (   $level)
static

Gets the name of the logging level.

Parameters
int$level
Returns
string
static Monolog\Logger::getLevels ( )
static

Gets all supported logging levels.

Returns
array Assoc array with human-readable level names => level codes.
Monolog\Logger::getName ( )
Returns
string
Monolog\Logger::getProcessors ( )
Returns
callable[]
Monolog\Logger::info (   $message,
array  $context = array() 
)

Adds a log record at the INFO level.

This method allows for compatibility with common interfaces.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed

Implements Psr\Log\LoggerInterface.

Monolog\Logger::isHandling (   $level)

Checks whether the Logger has a handler that listens on the given level

Parameters
int$level
Returns
Boolean
Monolog\Logger::log (   $level,
  $message,
array  $context = array() 
)

Adds a log record at an arbitrary level.

This method allows for compatibility with common interfaces.

Parameters
mixed$levelThe log level
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed

Implements Psr\Log\LoggerInterface.

Monolog\Logger::notice (   $message,
array  $context = array() 
)

Adds a log record at the NOTICE level.

This method allows for compatibility with common interfaces.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed

Implements Psr\Log\LoggerInterface.

Monolog\Logger::popHandler ( )

Pops a handler from the stack

Returns
HandlerInterface
Monolog\Logger::popProcessor ( )

Removes the processor on top of the stack and returns it.

Returns
callable
Monolog\Logger::pushHandler ( HandlerInterface  $handler)

Pushes a handler on to the stack.

Parameters
HandlerInterface$handler
Returns
$this
Monolog\Logger::pushProcessor (   $callback)

Adds a processor on to the stack.

Parameters
callable$callback
Returns
$this
Monolog\Logger::setHandlers ( array  $handlers)

Set handlers, replacing all existing ones.

If a map is passed, keys will be ignored.

Parameters
HandlerInterface[]$handlers
Returns
$this
static Monolog\Logger::setTimezone ( \DateTimeZone  $tz)
static

Set the timezone to be used for the timestamp of log records.

This is stored globally for all Logger instances

Parameters
\DateTimeZone$tzTimezone object
static Monolog\Logger::toMonologLevel (   $level)
static

Converts PSR-3 levels to Monolog ones if necessary

Parameters
string|intLevel number (monolog) or name (PSR-3)
Returns
int
Monolog\Logger::useMicrosecondTimestamps (   $micro)

Control the use of microsecond resolution timestamps in the 'datetime' member of new records.

Generating microsecond resolution timestamps by calling microtime(true), formatting the result via sprintf() and then parsing the resulting string via ::createFromFormat() can incur a measurable runtime overhead vs simple usage of DateTime to capture a second resolution timestamp in systems which generate a large number of log events.

Parameters
bool$microTrue to use microtime() to create timestamps
Monolog\Logger::warn (   $message,
array  $context = array() 
)

Adds a log record at the WARNING level.

This method allows for compatibility with common interfaces.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed
Monolog\Logger::warning (   $message,
array  $context = array() 
)

Adds a log record at the WARNING level.

This method allows for compatibility with common interfaces.

Parameters
string$messageThe log message
array$contextThe log context
Returns
Boolean Whether the record has been processed

Implements Psr\Log\LoggerInterface.

Monolog\Logger::withName (   $name)

Return a new cloned instance with the name changed

Returns
static

Member Data Documentation

Monolog\Logger::$levels
staticprotected
Initial value:
= array(
self::DEBUG => 'DEBUG',
self::INFO => 'INFO',
self::NOTICE => 'NOTICE',
self::WARNING => 'WARNING',
self::ERROR => 'ERROR',
self::CRITICAL => 'CRITICAL',
self::ALERT => 'ALERT',
self::EMERGENCY => 'EMERGENCY',
)
const Monolog\Logger::ALERT = 550

Action must be taken immediately

Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.

const Monolog\Logger::CRITICAL = 500

Critical conditions

Example: Application component unavailable, unexpected exception.

const Monolog\Logger::DEBUG = 100

Detailed debug information

const Monolog\Logger::EMERGENCY = 600

Urgent alert.

const Monolog\Logger::ERROR = 400

Runtime errors

const Monolog\Logger::INFO = 200

Interesting events

Examples: User logs in, SQL logs.

const Monolog\Logger::NOTICE = 250

Uncommon events

const Monolog\Logger::WARNING = 300

Exceptional occurrences that are not errors

Examples: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.


The documentation for this class was generated from the following file: