MockLogger
extends Logger
in package
Basic logger for OpenCloud which extends FIG's PSR-3 standard logger.
Table of Contents
- $criticalLogMessage : mixed
- $enabled : bool
- Is this debug class enabled or not?
- $options : array<string|int, mixed>
- Logging options.
- $urgentLevels : array<string|int, mixed>
- These are the levels which will always be outputted - regardless of user-imposed settings.
- __construct() : mixed
- alert() : void
- Action must be taken immediately.
- critical() : mixed
- debug() : void
- Detailed debug information.
- deprecated() : mixed
- Helper method, use PSR-3 warning function for deprecation warnings
- emergency() : void
- System is unusable.
- error() : void
- Runtime errors that do not require immediate action but should typically be logged and monitored.
- getCriticalLogMessage() : mixed
- getOption() : string|null
- Get an individual option.
- getOptions() : array<string|int, mixed>
- Get all options.
- info() : void
- Interesting events.
- isEnabled() : bool
- Is the debug class enabled?
- log() : mixed
- Outputs a log message if necessary.
- newInstance() : mixed
- notice() : void
- Normal but significant events.
- setEnabled() : self
- Enable or disable the debug class.
- setOption() : mixed
- Set an individual option.
- setOptions() : mixed
- Set an array of options.
- warning() : void
- Exceptional occurrences that are not errors.
- dispatch() : mixed
- Dispatch a log output message.
- formatFileLine() : string
- Used to format the line outputted in the log file.
- interpolate() : type
- Interpolates context values into the message placeholders.
- optionExists() : bool
- Check whether an individual option exists.
- outputIsUrgent() : bool
- Determines whether a log level needs to be outputted.
Properties
$criticalLogMessage
protected
mixed
$criticalLogMessage
$enabled
Is this debug class enabled or not?
private
bool
$enabled
$options
Logging options.
private
array<string|int, mixed>
$options
= array('outputToFile' => false, 'logFile' => null, 'dateFormat' => 'd/m/y H:I', 'delimeter' => ' - ')
$urgentLevels
These are the levels which will always be outputted - regardless of user-imposed settings.
private
array<string|int, mixed>
$urgentLevels
= array(PsrLogLogLevel::EMERGENCY, PsrLogLogLevel::ALERT, PsrLogLogLevel::CRITICAL)
Methods
__construct()
public
__construct([mixed $enabled = false ]) : mixed
Parameters
- $enabled : mixed = false
Return values
mixed —alert()
Action must be taken immediately.
public
alert(string $message[, array<string|int, mixed> $context = array() ]) : void
Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.
Parameters
- $message : string
- $context : array<string|int, mixed> = array()
Return values
void —critical()
public
critical(mixed $message[, array<string|int, mixed> $context = array() ]) : mixed
Parameters
- $message : mixed
- $context : array<string|int, mixed> = array()
Return values
mixed —debug()
Detailed debug information.
public
debug(string $message[, array<string|int, mixed> $context = array() ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = array()
Return values
void —deprecated()
Helper method, use PSR-3 warning function for deprecation warnings
public
static deprecated(mixed $method, mixed $new) : mixed
Parameters
- $method : mixed
- $new : mixed
Tags
Return values
mixed —emergency()
System is unusable.
public
emergency(string $message[, array<string|int, mixed> $context = array() ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = array()
Return values
void —error()
Runtime errors that do not require immediate action but should typically be logged and monitored.
public
error(string $message[, array<string|int, mixed> $context = array() ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = array()
Return values
void —getCriticalLogMessage()
public
getCriticalLogMessage() : mixed
Return values
mixed —getOption()
Get an individual option.
public
getOption(string $key) : string|null
Parameters
- $key : string
Return values
string|null —getOptions()
Get all options.
public
getOptions() : array<string|int, mixed>
Return values
array<string|int, mixed> —info()
Interesting events.
public
info(string $message[, array<string|int, mixed> $context = array() ]) : void
Example: User logs in, SQL logs.
Parameters
- $message : string
- $context : array<string|int, mixed> = array()
Return values
void —isEnabled()
Is the debug class enabled?
public
isEnabled() : bool
Return values
bool —log()
Outputs a log message if necessary.
public
log(mixed $level, string $message[, string $context = array() ]) : mixed
Parameters
- $level : mixed
- $message : string
- $context : string = array()
Return values
mixed —newInstance()
public
static newInstance() : mixed
Return values
mixed —notice()
Normal but significant events.
public
notice(string $message[, array<string|int, mixed> $context = array() ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = array()
Return values
void —setEnabled()
Enable or disable the debug class.
public
setEnabled(bool $enabled) : self
Parameters
- $enabled : bool
Return values
self —setOption()
Set an individual option.
public
setOption(string $key, string $value) : mixed
Parameters
- $key : string
- $value : string
Return values
mixed —setOptions()
Set an array of options.
public
setOptions([array<string|int, mixed> $options = array() ]) : mixed
Parameters
- $options : array<string|int, mixed> = array()
Return values
mixed —warning()
Exceptional occurrences that are not errors.
public
warning(string $message[, array<string|int, mixed> $context = array() ]) : void
Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
Parameters
- $message : string
- $context : array<string|int, mixed> = array()
Return values
void —dispatch()
Dispatch a log output message.
private
dispatch(string $message, array<string|int, mixed> $context) : mixed
Parameters
- $message : string
- $context : array<string|int, mixed>
Tags
Return values
mixed —formatFileLine()
Used to format the line outputted in the log file.
private
formatFileLine(string $string) : string
Parameters
- $string : string
Return values
string —interpolate()
Interpolates context values into the message placeholders.
private
interpolate(string $message[, array<string|int, mixed> $context = array() ]) : type
Parameters
- $message : string
- $context : array<string|int, mixed> = array()
Return values
type —optionExists()
Check whether an individual option exists.
private
optionExists(string $key) : bool
Parameters
- $key : string
Return values
bool —outputIsUrgent()
Determines whether a log level needs to be outputted.
private
outputIsUrgent(string $logLevel) : bool
Parameters
- $logLevel : string