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

Public Member Functions

 __construct (Google_Client $client)
 
 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.
 
 notice ($message, array $context=array())
 Normal but significant events.
 
 setLevel ($level)
 Sets the minimum logging level that this logger handles.
 
 shouldHandle ($level)
 Checks if the logger should handle messages at the provided level.
 
 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.
 

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_Abstract::__construct ( Google_Client $client)
Parameters
Google_Client$clientThe current Google client

Reimplemented in Google_Logger_File.

Member Function Documentation

◆ alert()

Google_Logger_Abstract::alert ( $message,
array $context = array() )

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() )

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() )

Detailed debug information.

Parameters
string$messageThe log message
array$contextThe log context

◆ emergency()

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

System is unusable.

Parameters
string$messageThe log message
array$contextThe log context

◆ error()

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

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)
protected

Exports a PHP value for logging to a string.

Parameters
mixed$valueThe value to

◆ info()

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

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())
protected

Interpolates log variables into the defined log format.

Parameters
array$variablesThe log variables.
Return values
string

◆ log()

Google_Logger_Abstract::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 in Google_Logger_Psr.

◆ normalizeLevel()

Google_Logger_Abstract::normalizeLevel ( $level)
protected

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() )

Normal but significant events.

Parameters
string$messageThe log message
array$contextThe log context

◆ reverseJsonInContext()

Google_Logger_Abstract::reverseJsonInContext ( array & $context)
protected

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

Parameters
array$contextThe log context

◆ setLevel()

Google_Logger_Abstract::setLevel ( $level)

Sets the minimum logging level that this logger handles.

Parameters
integer$level

◆ shouldHandle()

Google_Logger_Abstract::shouldHandle ( $level)

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

Parameters
integer$level
Return values
boolean

Reimplemented in Google_Logger_Null, and Google_Logger_Psr.

◆ warning()

Google_Logger_Abstract::warning ( $message,
array $context = array() )

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)
abstractprotected

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
staticprotected
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'

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'

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'

Default date format.

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

◆ INFO

const Google_Logger_Abstract::INFO = 'info'

Interesting events.

Example: User logs in, SQL logs.

◆ WARNING

const Google_Logger_Abstract::WARNING = 'warning'

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: