Logger
in package
implements
ILogger
Single Logger implementation.
Tags
Table of Contents
Interfaces
- ILogger
- Logger interface.
Properties
- $_context : array<string|int, mixed>
- $_destination : DestinationBase
- $_runLevel : RunLevel
- $channel : string|null
Methods
- __construct() : mixed
- addFilter() : bool
- alert() : void
- close() : void
- critical() : void
- debug() : void
- emergency() : void
- error() : void
- getChannel() : string|null
- Get the channel name for this logger.
- getContext() : array<string|int, mixed>
- getDestination() : mixed
- getRunLevel() : RunLevel
- info() : void
- log() : void
- notice() : void
- open() : mixed
- removeFilter() : bool
- reset() : void
- setChannel() : void
- Set the channel name for this logger.
- setContext() : void
- Add a context value to the log. Contexts are prepended to each log entry.
- setDestination() : void
- setRunLevel() : void
- setRunLevelText() : void
- Sets the run level by text.
- warning() : void
- interpolate() : string
- Interpolates context values into the message placeholders.
Properties
$_context
private
array<string|int, mixed>
$_context
= []
$_destination
private
DestinationBase
$_destination
$_runLevel
private
RunLevel
$_runLevel
= \Neuron\Log\RunLevel::ERROR
$channel
private
string|null
$channel
= null
Methods
__construct()
public
__construct(DestinationBase $dest) : mixed
Parameters
- $dest : DestinationBase
addFilter()
public
addFilter(FilterBase $filter) : bool
Parameters
- $filter : FilterBase
Return values
boolalert()
public
alert(string $text[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $text : string
- $context : array<string|int, mixed> = []
close()
public
close() : void
critical()
public
critical(string $text[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $text : string
- $context : array<string|int, mixed> = []
debug()
public
debug(string $text[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $text : string
- $context : array<string|int, mixed> = []
emergency()
public
emergency(string $text[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $text : string
- $context : array<string|int, mixed> = []
error()
public
error(string $text[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $text : string
- $context : array<string|int, mixed> = []
getChannel()
Get the channel name for this logger.
public
getChannel() : string|null
Return values
string|nullgetContext()
public
getContext() : array<string|int, mixed>
Return values
array<string|int, mixed>getDestination()
public
getDestination() : mixed
getRunLevel()
public
getRunLevel() : RunLevel
Return values
RunLevelinfo()
public
info(string $text[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $text : string
- $context : array<string|int, mixed> = []
log()
public
log(string $text, RunLevel $level[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $text : string
- $level : RunLevel
- $context : array<string|int, mixed> = []
notice()
public
notice(string $text[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $text : string
- $context : array<string|int, mixed> = []
open()
public
open(array<string|int, mixed> $params) : mixed
Parameters
- $params : array<string|int, mixed>
removeFilter()
public
removeFilter(IFilter $filter) : bool
Parameters
- $filter : IFilter
Return values
boolreset()
public
reset() : void
setChannel()
Set the channel name for this logger.
public
setChannel(string|null $channel) : void
Parameters
- $channel : string|null
setContext()
Add a context value to the log. Contexts are prepended to each log entry.
public
setContext(string $name, mixed $value) : void
Parameters
- $name : string
- $value : mixed
-
Can be string, array, or other scalar/object types
setDestination()
public
setDestination(DestinationBase $dest) : void
Parameters
- $dest : DestinationBase
setRunLevel()
public
setRunLevel(mixed $level) : void
Parameters
- $level : mixed
-
string|int either the run level or a string representation of it.
Tags
setRunLevelText()
Sets the run level by text.
public
setRunLevelText(string $level) : void
Parameters
- $level : string
Tags
warning()
public
warning(string $text[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $text : string
- $context : array<string|int, mixed> = []
interpolate()
Interpolates context values into the message placeholders.
private
interpolate(string $message, array<string|int, mixed> $context) : string
Implements PSR-3 style message interpolation.
Parameters
- $message : string
- $context : array<string|int, mixed>