$retrievalPolicies
$retrievalPolicies :
Logger for PHP event/error/exception logging.
A logger in its basic form typically handles the following tasks:
- Instantiate a LoggerContent object and provide it with a format blueprint in form of a static FormatDescriptor class
- Initialize a DataRetriever and provide it with a LoggerContent object (and if applicable with RetrievalPolicies)
- Initialize a DataValidator and provide it with a LoggerContent object
- Initialize a DataFormatter and provide it with a LoggerContent object
- Provide a method to perform the actual logging (i.e. invoke retriever, validator and formatter accordingly)
log(array $params = null) : array
Perform the actual logging process:
array | $params | Logger parameters (int "loglevel", string "message", array "context", bool "validate" default "false", bool "format" default "true") |
Validation (or other) errors (null if none)
getInstance(array|mixed|null $inject = null) : \phpWTL\$_instance[$class]
Create new instance or give back already existing one.
array|mixed|null | $inject | Can be used to inject one or more parameter(s) into the constructor |
The instance of a derived class
interpolateContextData(string $message, array $context = array()) : string
Interpolate context values into the (brace-delimited) message placeholders (see also: https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-3-logger-interface.md).
string | $message | |
array | $context | Key-value pairs for context data |
Message with all {placeholders} replaced by their respective context variable contents.
e2arr(\phpWTL\exception $e) : array
Transform contents of the given exception object into an associative array.
\phpWTL\exception | $e |
Array representation of exception object, keys analog to the corr. methods of the exception object: eMessage, ePrevious, eCode, eFile, eLine, eTrace, eTraceAsString, eToString (__toString of whole ex. obj.).
e2json(\phpWTL\exception $e, integer $jsonParams = null) : string
Transform contents of the given exception object into a JSON data structure (wrapper).
\phpWTL\exception | $e | |
integer | $jsonParams | Parameter for "json_encode" function (optional) |
JSON representation of exception object, keys analog to the corr. methods of the exception object: eMessage, ePrevious, eCode, eFile, eLine, eTrace, eTraceAsString, eToString (__toString of whole ex. obj.).
__construct(integer $loglevel = null)
The constructor must perform the following taks:
integer | $loglevel | Threshold for logger (default: LOGLEVEL_WARNING). |
context2json(array $context, array $exclude_keys, integer $jsonParams = null) : string
Transform context array into a JSON data structure.
array | $context | |
array | $exclude_keys | |
integer | $jsonParams | Parameter for "json_encode" function (optional) |
JSON representation of context data.