Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
Mustache_Logger_StreamLogger Class Reference
Inheritance diagram for Mustache_Logger_StreamLogger:
Mustache_Logger_AbstractLogger Mustache_Logger

Public Member Functions

 __construct ($stream, $level=Mustache_Logger::ERROR)
 
 __destruct ()
 Close stream resources.
 
 alert ($message, array $context=array())
 Action must be taken immediately.
 
 critical ($message, array $context=array())
 Critical conditions.
 
 debug ($message, array $context=array())
 Detailed debug information.
 
 emergency ($message, array $context=array())
 System is unusable.
 
 error ($message, array $context=array())
 Runtime errors that do not require immediate action but should typically be logged and monitored.
 
 getLevel ()
 Get the current minimum logging level.
 
 info ($message, array $context=array())
 Interesting events.
 
 log ($level, $message, array $context=array())
 Logs with an arbitrary level.
 
 notice ($message, array $context=array())
 Normal but significant events.
 
 setLevel ($level)
 Set the minimum logging level.
 
 warning ($message, array $context=array())
 Exceptional occurrences that are not errors.
 

Public Attributes

const ALERT = 'alert'
 
const CRITICAL = 'critical'
 
const DEBUG = 'debug'
 
const EMERGENCY = 'emergency'
 Psr\Log compatible log levels.
 
const ERROR = 'error'
 
const INFO = 'info'
 
const NOTICE = 'notice'
 
const WARNING = 'warning'
 

Protected Member Functions

 writeLog ($level, $message, array $context=array())
 Write a record to the log.
 

Static Protected Member Functions

static formatLine ($level, $message, array $context=array())
 Format a log line for output.
 
static getLevelName ($level)
 Gets the name of the logging level.
 
static interpolateMessage ($message, array $context=array())
 Interpolate context values into the message placeholders.
 

Protected Attributes

 $level
 
 $stream = null
 
 $url = null
 

Static Protected Attributes

static $levels
 

Constructor & Destructor Documentation

◆ __construct()

Mustache_Logger_StreamLogger::__construct ( $stream,
$level = Mustache_Logger::ERROR )
Exceptions
InvalidArgumentExceptionif the logging level is unknown
Parameters
resource | string$streamResource instance or URL
int$levelThe minimum logging level at which this handler will be triggered

Member Function Documentation

◆ alert()

Mustache_Logger_AbstractLogger::alert ( $message,
array $context = array() )
inherited

Action must be taken immediately.

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

Parameters
string$message
array$context

Implements Mustache_Logger.

◆ critical()

Mustache_Logger_AbstractLogger::critical ( $message,
array $context = array() )
inherited

Critical conditions.

Example: Application component unavailable, unexpected exception.

Parameters
string$message
array$context

Implements Mustache_Logger.

◆ debug()

Mustache_Logger_AbstractLogger::debug ( $message,
array $context = array() )
inherited

Detailed debug information.

Parameters
string$message
array$context

Implements Mustache_Logger.

◆ emergency()

Mustache_Logger_AbstractLogger::emergency ( $message,
array $context = array() )
inherited

System is unusable.

Parameters
string$message
array$context

Implements Mustache_Logger.

◆ error()

Mustache_Logger_AbstractLogger::error ( $message,
array $context = array() )
inherited

Runtime errors that do not require immediate action but should typically be logged and monitored.

Parameters
string$message
array$context

Implements Mustache_Logger.

◆ formatLine()

static Mustache_Logger_StreamLogger::formatLine ( $level,
$message,
array $context = array() )
staticprotected

Format a log line for output.

Parameters
int$levelThe logging level
string$messageThe log message
array$contextThe log context
Return values
string

◆ getLevel()

Mustache_Logger_StreamLogger::getLevel ( )

Get the current minimum logging level.

Return values
int

◆ getLevelName()

static Mustache_Logger_StreamLogger::getLevelName ( $level)
staticprotected

Gets the name of the logging level.

Exceptions
InvalidArgumentExceptionif the logging level is unknown
Parameters
int$level
Return values
string

◆ info()

Mustache_Logger_AbstractLogger::info ( $message,
array $context = array() )
inherited

Interesting events.

Example: User logs in, SQL logs.

Parameters
string$message
array$context

Implements Mustache_Logger.

◆ interpolateMessage()

static Mustache_Logger_StreamLogger::interpolateMessage ( $message,
array $context = array() )
staticprotected

Interpolate context values into the message placeholders.

Parameters
string$message
array$context
Return values
string

◆ log()

Mustache_Logger_StreamLogger::log ( $level,
$message,
array $context = array() )

Logs with an arbitrary level.

Exceptions
Mustache_Exception_InvalidArgumentExceptionif the logging level is unknown
Parameters
mixed$level
string$message
array$context

Implements Mustache_Logger.

◆ notice()

Mustache_Logger_AbstractLogger::notice ( $message,
array $context = array() )
inherited

Normal but significant events.

Parameters
string$message
array$context

Implements Mustache_Logger.

◆ setLevel()

Mustache_Logger_StreamLogger::setLevel ( $level)

Set the minimum logging level.

Exceptions
Mustache_Exception_InvalidArgumentExceptionif the logging level is unknown
Parameters
int$levelThe minimum logging level which will be written

◆ warning()

Mustache_Logger_AbstractLogger::warning ( $message,
array $context = array() )
inherited

Exceptional occurrences that are not errors.

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

Parameters
string$message
array$context

Implements Mustache_Logger.

◆ writeLog()

Mustache_Logger_StreamLogger::writeLog ( $level,
$message,
array $context = array() )
protected

Write a record to the log.

Exceptions
Mustache_Exception_LogicExceptionIf neither a stream resource nor url is present
Mustache_Exception_RuntimeExceptionIf the stream url cannot be opened
Parameters
int$levelThe logging level
string$messageThe log message
array$contextThe log context

Member Data Documentation

◆ $levels

Mustache_Logger_StreamLogger::$levels
staticprotected
Initial value:
= array(
self::DEBUG => 100,
self::INFO => 200,
self::NOTICE => 250,
self::WARNING => 300,
self::ERROR => 400,
self::CRITICAL => 500,
self::ALERT => 550,
self::EMERGENCY => 600,
)

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