\phpWTLCombinedLogger

Logger for the combined log format, which is NCSA common plus two additional fields (see: https://httpd.apache.org/docs/1.3/logs.html#combined).

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
getBuffer()
setDataRetrievalPolicies()
log()
getDataRetrievalPolicies()
getFormatDescriptor()
getLoggerContent()
getDataRetriever()
getDataValidator()
getDataFormatter()
getInstance()
No public properties found
No constants found
__construct()
initializeBuffering()
finalizeBuffering()
loadDataRetrievalPoliciesDefault()
__clone()
__sleep()
__wakeup()
$retrievalPolicies
$loggerContent
$dataRetriever
$dataValidator
$dataFormatter
$_instance
N/A
No private methods found
No private properties found
N/A

Properties

$retrievalPolicies

$retrievalPolicies : 

Type

$loggerContent

$loggerContent : 

Type

$dataRetriever

$dataRetriever : 

Type

$dataValidator

$dataValidator : 

Type

$dataFormatter

$dataFormatter : 

Type

$_instance

$_instance : 

Array to hold instances of all derived classes.

Type

Methods

getBuffer()

getBuffer() : string

Return PHP output buffer.

Returns

string —

buffer content (null if logging mode is not buffered)

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.

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

getFormatDescriptor()

getFormatDescriptor() 

getLoggerContent()

getLoggerContent() 

getDataRetriever()

getDataRetriever() 

getDataValidator()

getDataValidator() 

getDataFormatter()

getDataFormatter() 

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

__construct()

__construct(object  $retrievalPolicies = null) 

The constructor must perform the following taks:

  • Call "loadRetrievalPolicies" or handle the policies otherwise appropriately
  • Instantiate and store a LoggerContent object based on the required static FormatDescriptor
  • Handle/store all other (optional) parts neccessary and/or wanted (data retriever, validator, formatter)
  • Handle buffer initialization for ContentLengthRetrieval policy

Parameters

object $retrievalPolicies

Provide policies for data retrieval (if applicable).

initializeBuffering()

initializeBuffering() 

Buffer initialization for ContentLengthRetrieval policy.

finalizeBuffering()

finalizeBuffering() 

Buffer finalization for ContentLengthRetrieval policy (flush, store content-length).

loadDataRetrievalPoliciesDefault()

loadDataRetrievalPoliciesDefault() 

Set default data retrieval policies.

__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