\phpWTLaBasicLogger

Abstract logger class.

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)

Summary

Methods
Properties
Constants
getInstance()
log()
getDataRetrievalPolicies()
setDataRetrievalPolicies()
getFormatDescriptor()
getLoggerContent()
getDataRetriever()
getDataValidator()
getDataFormatter()
No public properties found
No constants found
__clone()
__sleep()
__wakeup()
__construct()
loadDataRetrievalPoliciesDefault()
$_instance
$retrievalPolicies
$loggerContent
$dataRetriever
$dataValidator
$dataFormatter
N/A
No private methods found
No private properties found
N/A

Properties

$_instance

$_instance : 

Array to hold instances of all derived classes.

Type

$retrievalPolicies

$retrievalPolicies : 

Type

$loggerContent

$loggerContent : 

Type

$dataRetriever

$dataRetriever : 

Type

$dataValidator

$dataValidator : 

Type

$dataFormatter

$dataFormatter : 

Type

Methods

getInstance()

getInstance(array|mixed|null  $inject = null) : \phpWTL\$_instance[$class]

Create new instance or give back already existing one.

Parameters

array|mixed|null $inject

Can be used to inject one or more parameter(s) into the constructor

Returns

\phpWTL\$_instance[$class] —

The instance of a derived class

log()

log(array  $params = null) : array

Perform the actual logging process (delegate single tasks to retriever, validator and formatter).

Parameters

array $params

Logger specific parameters

Returns

array —

Validation errors (empty if none)

getDataRetrievalPolicies()

getDataRetrievalPolicies() : array

Return data retrieval policies set during initialization.

Returns

array

setDataRetrievalPolicies()

setDataRetrievalPolicies(array  $retrievalPolicies = null) 

Set data retrieval policies after initialization:

  • Also do this in the associated data retriever
  • If null restore the default

Parameters

array $retrievalPolicies

Provide policies for data retrieval.

getFormatDescriptor()

getFormatDescriptor() 

getLoggerContent()

getLoggerContent() 

getDataRetriever()

getDataRetriever() 

getDataValidator()

getDataValidator() 

getDataFormatter()

getDataFormatter() 

__clone()

__clone() 

Disable cloning for singleton.

Throws

\phpWTL\Exception

if called

__sleep()

__sleep() 

Disable serialization for singleton.

Throws

\phpWTL\Exception

if called

__wakeup()

__wakeup() 

Disable de-serialization for singleton.

Throws

\phpWTL\Exception

if called

__construct()

__construct(object|null  $inject = null) 

Constructor stump.

Parameters

object|null $inject

Can be used to inject one or more parameter(s) into the constructor.

loadDataRetrievalPoliciesDefault()

loadDataRetrievalPoliciesDefault() 

Set default data retrieval policies.