Plop
A simple logging library for PHP
Plop\Record Class Reference

A class that stores a log record. More...

+ Inheritance diagram for Plop\Record:

Public Member Functions

 __construct ($loggerNamespace, $loggerClass, $loggerMethod, $namespace, $class, $method, $level, $pathname, $lineno, $msg, array $args,\Plop\InterpolatorInterface $interpolator,\Exception $exception=null)
 
 asArray ()
 
 getInterpolator ()
 
 getMessage ()
 
 offsetExists ($offset)
 
 offsetGet ($offset)
 
 offsetSet ($offset, $value)
 
 offsetUnset ($offset)
 
 serialize ()
 
 setInterpolator (\Plop\InterpolatorInterface $interpolator)
 
 unserialize ($data)
 

Protected Attributes

 $dict
 Array of properties for the log record.
 

Detailed Description

A class that stores a log record.

A log records contains everything that is related to a specific log, like what time it was emitted at, the level of the log, the file that emitted it, etc.

Definition at line 31 of file Record.php.

Constructor & Destructor Documentation

Plop\Record::__construct (   $loggerNamespace,
  $loggerClass,
  $loggerMethod,
  $namespace,
  $class,
  $method,
  $level,
  $pathname,
  $lineno,
  $msg,
array  $args,
\Plop\InterpolatorInterface  $interpolator,
\Exception  $exception = null 
)

Construct a new log record.

Parameters
string$loggerNamespaceNamespace associated with the logger that captured the log.
string$loggerClassClass associated with the logger that captured the log.
string$loggerMethodMethod or function associated with the logger that captured the log.
string$namespaceNamespace where the log was emitted.
string$classClass where the log was emitted.
string$methodMethod or function where the log was emitted.
int$levelThe level of the log.
string$pathnameThe name of the file where the log was emitted.
int$linenoThe line number where the log was emitted inside the file indicated by the $pathname parameter.
string$msgThe message to log.
array$argsAdditional arguments for the log message.
Plop::InterpolatorInterface$interpolatorInterpolator to use during record formatting.
null | Exception$exceptionAn exception whose backtrace will be merged into the log message.

Definition at line 80 of file Record.php.

References Plop\Plop\getInstance().

Member Function Documentation

Plop\Record::asArray ( )

The properties of this log record, as an associative array.

Return values
arrayAn associative array with the properties of this log record.

Implements Plop\RecordInterface.

Definition at line 265 of file Record.php.

Plop\Record::getInterpolator ( )

Return this record's message interpolator.

Return values
Plop::InterpolatorInterfaceMessage interpolator.

Implements Plop\RecordInterface.

Definition at line 152 of file Record.php.

Plop\Record::getMessage ( )

Return the message stored in this log record, after all interpolated variables have been replaced in it.

Return values
stringThe message stored in the log record.

Implements Plop\RecordInterface.

Definition at line 165 of file Record.php.

Plop\Record::offsetExists (   $offset)

Test whether a given property exists for this log record.

Parameters
string$offsetThe name of the property whose existence must be checked.
Return values
booltrue if the given property exists for this log record, false otherwise.

Implements ArrayAccess.

Definition at line 248 of file Record.php.

Plop\Record::offsetGet (   $offset)

Return the value for one of the properties of the log record.

Parameters
string$offsetThe name of the property to return. The default properties include:
  • args
  • class
  • created
  • createdDate
  • exc_info
  • exc_text
  • filename
  • funcName
  • hostname
  • levelname
  • levelno
  • lineno
  • loggerClass
  • loggerFile
  • loggerMethod
  • method
  • module
  • msecs
  • msg
  • namespace
  • pathname
  • process
  • processName
  • relativeCreated
  • threadId
  • threadCreatorId

Additional properties may be available.

Return values
mixedThe value for that property.

Implements ArrayAccess.

Definition at line 212 of file Record.php.

Plop\Record::offsetSet (   $offset,
  $value 
)

Add/set a new value for a property of this log.

Parameters
string$offsetThe name of the property to add/set.
mixed$valueThe new value for that property.
See also
Plop::Record::offsetGet() for the names of all default properties.

Implements ArrayAccess.

Definition at line 231 of file Record.php.

Plop\Record::offsetUnset (   $offset)

Remove a property from this log record.

Parameters
string$offsetThe name of the property to remove.

Implements ArrayAccess.

Definition at line 259 of file Record.php.

Plop\Record::serialize ( )

Serialize this log record.

Return values
stringSerialized representation of this record.

Definition at line 276 of file Record.php.

Plop\Record::setInterpolator ( \Plop\InterpolatorInterface  $interpolator)

Implements Plop\RecordInterface.

Definition at line 158 of file Record.php.

Plop\Record::unserialize (   $data)

Reconstruct a log record from its serialized representation.

Parameters
string$dataSerialized representation of the record.
Returns
This method does not return any value.

Definition at line 291 of file Record.php.


The documentation for this class was generated from the following file: