Class LoggerMDC
The LoggerMDC class provides mapped diagnostic contexts.
A Mapped Diagnostic Context, or MDC in short, is an instrument for
distinguishing interleaved log output from different sources. Log output
is typically interleaved when a server handles multiple clients
near-simultaneously.
This class is similar to the LoggerNDC class except that
it is based on a map instead of a stack.
Methods summary
public static
|
#
put( string $key, string $value )
Stores a context value as identified with the key parameter into the
context map.
Stores a context value as identified with the key parameter into the
context map.
Parameters
- $key
- the key
- $value
- the value
|
public static
string
|
#
get( string $key )
Returns the context value identified by the key parameter.
Returns the context value identified by the key parameter.
Parameters
Returns
string The context or an empty string if no context found
for given key.
|
public static
array
|
#
getMap( )
Returns the contex map as an array.
Returns the contex map as an array.
Returns
array The MDC context map.
|
public static
|
#
remove( string $key )
Removes the the context identified by the key parameter.
Removes the the context identified by the key parameter.
Only affects user mappings, not $_ENV or $_SERVER.
Parameters
- $key
- The key to be removed.
|
public static
|
#
clear( )
Clears the mapped diagnostic context.
Clears the mapped diagnostic context.
|