When you call the
log() method or one of its shortcuts, a
log event is created. This is simply an associative array with data
describing the event that is passed to the writers. The following keys
are always created in this array: timestamp,
message, priority, and
The creation of the event array is completely transparent. However, knowledge of the event array is required for adding an item that does not exist in the default set above.
To add a new item to every future event, call the
setEventItem() method giving a key and a value:
The example above sets a new item named pid and populates
it with the PID of the current process. Once a new item has been
set, it is available automatically to all writers along with all of the
other data event data during logging. An item can be overwritten at any
time by calling the
setEventItem() method again.
Setting a new event item with
setEventItem() causes the
new item to be sent to all writers of the logger. However, this does
not guarantee that the writers actually record the item. This is
because the writers won't know what to do with it unless a formatter
object is informed of the new item. Please see the section on Formatters
to learn more.