PioniaLogger
in package
implements
LoggerInterface
Uses
Containable
Table of Contents
Interfaces
- LoggerInterface
Properties
- $context : ContainerInterface|Container|null
- Application container context
- $baseLogger : LoggerInterface
- $destination : string|null
- $formatter : FormatterInterface|null
- $handlers : Arrayable|null
- $hiddenKeys : array<string|int, mixed>
- $name : string
- $processors : Arrayable|null
- $settings : Arrayable
Methods
- __construct() : mixed
- addHandler() : static
- alert() : void
- contextArrAdd() : void
- contextHas() : bool
- Check if a value exists in the container
- contextMake() : mixed
- Make an instance of a class from the container. This will throw an exception if the class is not found
- contextMakeSilently() : mixed
- Create an instance of a class without throwing an exception when it fails
- critical() : void
- debug() : void
- emergency() : void
- error() : void
- getOrDefault() : mixed
- Get a value from the container or return a default value
- getOrFail() : mixed
- Get a value from the container or throw an exception.
- getSilently() : mixed
- Get a value from the container or return null instead of throwing an exception
- hideInLogs() : array<string|int, mixed>
- This method will hide the secure keys in the logs
- info() : void
- log() : void
- notice() : void
- resolveDestination() : void
- sets up our logger destination.
- set() : static
- Set a value in the container
- setLogger() : void
- warning() : void
- addFormatter() : void
- resolveHandlers() : void
Properties
$context
Application container context
public
ContainerInterface|Container|null
$context
$baseLogger
private
LoggerInterface
$baseLogger
= null
|Logger | null The base logger we shall rely on. By default it is the Monolog Logger
$destination
private
string|null
$destination
= null
The destination to log to
$formatter
private
FormatterInterface|null
$formatter
The formatter to use
$handlers
private
Arrayable|null
$handlers
log handlers to use
$hiddenKeys
private
array<string|int, mixed>
$hiddenKeys
= ['password', 'pass', 'pin', 'passwd', 'secret_key', 'pwd', 'token', 'credit_card', 'creditcard', 'cc', 'secret', 'cvv', 'cvn']
$name
private
string
$name
$processors
private
Arrayable|null
$processors
log processors to use
$settings
private
Arrayable
$settings
The settings for the logger, it is the logging section in the database.ini file or settings from the application
Methods
__construct()
public
__construct(PioniaApplication $app) : mixed
Parameters
- $app : PioniaApplication
addHandler()
public
addHandler(callable $callable) : static
Parameters
- $callable : callable
Return values
staticalert()
public
alert(Stringable|string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : Stringable|string
- $context : array<string|int, mixed> = []
contextArrAdd()
public
contextArrAdd(string $contextKey, array<string|int, mixed> $dataToAdd) : void
Parameters
- $contextKey : string
- $dataToAdd : array<string|int, mixed>
contextHas()
Check if a value exists in the container
public
contextHas(string $key) : bool
Parameters
- $key : string
Return values
boolcontextMake()
Make an instance of a class from the container. This will throw an exception if the class is not found
public
contextMake(string $name[, array<string|int, mixed> $parameters = [] ]) : mixed
Parameters
- $name : string
- $parameters : array<string|int, mixed> = []
Tags
contextMakeSilently()
Create an instance of a class without throwing an exception when it fails
public
contextMakeSilently(string $name[, array<string|int, mixed> $parameters = [] ]) : mixed
Parameters
- $name : string
- $parameters : array<string|int, mixed> = []
critical()
public
critical(Stringable|string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : Stringable|string
- $context : array<string|int, mixed> = []
debug()
public
debug(Stringable|string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : Stringable|string
- $context : array<string|int, mixed> = []
emergency()
public
emergency(Stringable|string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : Stringable|string
- $context : array<string|int, mixed> = []
error()
public
error(Stringable|string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : Stringable|string
- $context : array<string|int, mixed> = []
getOrDefault()
Get a value from the container or return a default value
public
getOrDefault(string $key, mixed $default) : mixed
Parameters
- $key : string
- $default : mixed
getOrFail()
Get a value from the container or throw an exception.
public
getOrFail(string $key) : mixed
Parameters
- $key : string
Tags
getSilently()
Get a value from the container or return null instead of throwing an exception
public
getSilently(mixed $key) : mixed
Parameters
- $key : mixed
hideInLogs()
This method will hide the secure keys in the logs
public
hideInLogs([array<string|int, mixed> $data = [] ]) : array<string|int, mixed>
Parameters
- $data : array<string|int, mixed> = []
-
The data whose secure keys are to be hidden
Return values
array<string|int, mixed> —The data with the hidden keys hidden
info()
public
info(Stringable|string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : Stringable|string
- $context : array<string|int, mixed> = []
log()
public
log(mixed $level, Stringable|string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $level : mixed
- $message : Stringable|string
- $context : array<string|int, mixed> = []
notice()
public
notice(Stringable|string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : Stringable|string
- $context : array<string|int, mixed> = []
resolveDestination()
sets up our logger destination.
public
resolveDestination([string|null $destination = null ]) : void
You can also define the LOG_DESTINATION in the logging section of the database.ini file. This must be relative to the logs folder. If you want to log to a file, you can define the LOGS_DESTINATION_FILE in the context. This will be used as the destination.
Parameters
- $destination : string|null = null
set()
Set a value in the container
public
set(string $name, mixed $value) : static
Parameters
- $name : string
- $value : mixed
Return values
staticsetLogger()
public
setLogger([LoggerInterface|null $logger = null ]) : void
Parameters
- $logger : LoggerInterface|null = null
warning()
public
warning(Stringable|string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : Stringable|string
- $context : array<string|int, mixed> = []
addFormatter()
private
addFormatter([FormatterInterface|null $formatter = null ]) : void
Parameters
- $formatter : FormatterInterface|null = null
resolveHandlers()
private
resolveHandlers() : void