Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
Google_Logger_Psr Class Reference
Inheritance diagram for Google_Logger_Psr:
Google_Logger_Abstract

Public Member Functions

 __construct (Google_Client $client, $logger=null)
 
 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.
 
 info ($message, array $context=array())
 Interesting events.
 
 log ($level, $message, array $context=array())
 {Logs with an arbitrary level.
Parameters
mixed$levelThe log level
string$messageThe log message
array$contextThe log context
}
 
 notice ($message, array $context=array())
 Normal but significant events.
 
 setLevel ($level)
 Sets the minimum logging level that this logger handles.
 
 setLogger ( $logger)
 Sets the PSR-3 logger where logging will be delegated.
 
 shouldHandle ($level)
 {Checks if the logger should handle messages at the provided level.
Parameters
integer$level
Return values
boolean
}
 
 warning ($message, array $context=array())
 Exceptional occurrences that are not errors.
 

Public Attributes

const ALERT = 'alert'
 Action must be taken immediately.
 
const CRITICAL = 'critical'
 Critical conditions.
 
const DEBUG = 'debug'
 Detailed debug information.
 
const DEFAULT_DATE_FORMAT = 'd/M/Y:H:i:s O'
 Default date format.
 
const DEFAULT_LOG_FORMAT = "[%datetime%] %level%: %message% %context%\n"
 Default log format.
 
const EMERGENCY = 'emergency'
 System is unusable.
 
const ERROR = 'error'
 Runtime errors that do not require immediate action but should typically be logged and monitored.
 
const INFO = 'info'
 Interesting events.
 
const NOTICE = 'notice'
 Normal but significant events.
 
const WARNING = 'warning'
 Exceptional occurrences that are not errors.
 

Protected Member Functions

 export ($value)
 Exports a PHP value for logging to a string.
 
 interpolate (array $variables=array())
 Interpolates log variables into the defined log format.
 
 normalizeLevel ($level)
 Converts a given log level to the integer form.
 
 reverseJsonInContext (array &$context)
 Reverses JSON encoded PHP arrays and objects so that they log better.
 
 write ($message)
 Writes a message to the current log implementation.
 
 write ($message, array $context=array())
 {}
 

Protected Attributes

boolean $allowNewLines = false
 $allowNewLines If newlines are allowed
 
string $dateFormat = self::DEFAULT_DATE_FORMAT
 $dateFormat The current date format
 
integer $level = self::DEBUG
 $level The minimum logging level
 
string $logFormat = self::DEFAULT_LOG_FORMAT
 $logFormat The current log format
 

Static Protected Attributes

static array $levels
 $levels Logging levels
 

Constructor & Destructor Documentation

◆ __construct()

Google_Logger_Psr::__construct ( Google_Client $client,
$logger = null )
Parameters
Google_Client$clientThe current Google client
Psr\Log\LoggerInterface$loggerPSR-3 logger where logging will be delegated.

Member Function Documentation

◆ alert()

Google_Logger_Abstract::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$messageThe log message
array$contextThe log context

◆ critical()

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

Critical conditions.

Example: Application component unavailable, unexpected exception.

Parameters
string$messageThe log message
array$contextThe log context

◆ debug()

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

Detailed debug information.

Parameters
string$messageThe log message
array$contextThe log context

◆ emergency()

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

System is unusable.

Parameters
string$messageThe log message
array$contextThe log context

◆ error()

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

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

Parameters
string$messageThe log message
array$contextThe log context

◆ export()

Google_Logger_Abstract::export ( $value)
protectedinherited

Exports a PHP value for logging to a string.

Parameters
mixed$valueThe value to

◆ info()

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

Interesting events.

Example: User logs in, SQL logs.

Parameters
string$messageThe log message
array$contextThe log context

◆ interpolate()

Google_Logger_Abstract::interpolate ( array $variables = array())
protectedinherited

Interpolates log variables into the defined log format.

Parameters
array$variablesThe log variables.
Return values
string

◆ log()

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

{Logs with an arbitrary level.

Parameters
mixed$levelThe log level
string$messageThe log message
array$contextThe log context
}

Reimplemented from Google_Logger_Abstract.

◆ normalizeLevel()

Google_Logger_Abstract::normalizeLevel ( $level)
protectedinherited

Converts a given log level to the integer form.

Parameters
mixed$levelThe logging level
Return values
integer\$levelThe normalized level
Exceptions
Google_Logger_ExceptionIf $level is invalid

◆ notice()

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

Normal but significant events.

Parameters
string$messageThe log message
array$contextThe log context

◆ reverseJsonInContext()

Google_Logger_Abstract::reverseJsonInContext ( array & $context)
protectedinherited

Reverses JSON encoded PHP arrays and objects so that they log better.

Parameters
array$contextThe log context

◆ setLevel()

Google_Logger_Abstract::setLevel ( $level)
inherited

Sets the minimum logging level that this logger handles.

Parameters
integer$level

◆ setLogger()

Google_Logger_Psr::setLogger ( $logger)

Sets the PSR-3 logger where logging will be delegated.

NOTE: The $logger should technically implement Psr\Log\LoggerInterface, but we don't explicitly require this so that we can be compatible with PHP 5.2.

Parameters
Psr\Log\LoggerInterface$loggerThe PSR-3 logger

◆ shouldHandle()

Google_Logger_Psr::shouldHandle ( $level)

{Checks if the logger should handle messages at the provided level.

Parameters
integer$level
Return values
boolean
}

Reimplemented from Google_Logger_Abstract.

◆ warning()

Google_Logger_Abstract::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$messageThe log message
array$contextThe log context

◆ write()

Google_Logger_Abstract::write ( $message)
abstractprotectedinherited

Writes a message to the current log implementation.

Parameters
string$messageThe message

Reimplemented in Google_Logger_File.

Member Data Documentation

◆ $levels

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

$levels Logging levels

◆ ALERT

const Google_Logger_Abstract::ALERT = 'alert'
inherited

Action must be taken immediately.

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

◆ CRITICAL

const Google_Logger_Abstract::CRITICAL = 'critical'
inherited

Critical conditions.

Example: Application component unavailable, unexpected exception.

◆ DEFAULT_DATE_FORMAT

const Google_Logger_Abstract::DEFAULT_DATE_FORMAT = 'd/M/Y:H:i:s O'
inherited

Default date format.

Example: 16/Nov/2014:03:26:16 -0500

◆ INFO

const Google_Logger_Abstract::INFO = 'info'
inherited

Interesting events.

Example: User logs in, SQL logs.

◆ WARNING

const Google_Logger_Abstract::WARNING = 'warning'
inherited

Exceptional occurrences that are not errors.

Example: 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: