This class contains the main functionalities for the module logging in
CONTENIDO.
The funcationality is almost the same like normal logging with the exception,
that log entries contains an additional information about the used module.
Example:
$writer = cLogWriter::factory("File", array('destination' =>
'contenido.log'));
$log = new cModuleLog($writer);
$log->setModule(1);
$log->log("Anything you want to log.");
Methods
Magic call method for direct priority named calls.
__call(string $method, array $arguments) : void
Inherited
inherited_from |
\cLog::__call() |
Parameters
$method
string
Name of the method
$arguments
array
Array with the method arguments
Exceptions
Constructor of the module log.
__construct(mixed $writer)
The log format interface of cLog is capable of being extended by subclasses. See the note about
the log shortcuts below.
About Log Shortcuts
Log shortcuts are placeholders which are replaced when a log entry is created. Placeholders start with a
percentage sign (%) and contain one or more characters. Each placeholder is handled by an own function which
decides what to do.
Parameters
$writer
mixed
writer Writer object (any subclass of cLogWriter), or false
if cLog should handle the writer creation
Adds a new priority to the log.
addPriority(string $name, int $value) : void
Inherited
inherited_from |
\cLog::addPriority() |
Parameters
$name
string
Name of the log priority
$value
int
Index value of the log priority
Exceptions
Buffers a log message for committing them on a later moment.
buffer(string $message, mixed $priority) : void
Inherited
inherited_from |
\cLog::buffer() |
Parameters
$message
string
Message to buffer
$priority
mixed
Priority of the log entry (optional)
Commits all buffered messages and empties the message buffer if parameter is not false.
commit(boolean $revoke) : void
Inherited
inherited_from |
\cLog::commit() |
Parameters
$revoke
boolean
Flag, whether the buffer is cleared or not (optional, default: true)
Returns the local writer instance.
getWriter() : \cLogWriter
Inherited
inherited_from |
\cLog::getWriter() |
Returns
Logs a message using the local writer instance
log(string $message, mixed $priority) : void
Inherited
inherited_from |
\cLog::log() |
Parameters
$message
string
Message to log
$priority
mixed
Priority of the log entry (optional)
Removes a priority from log.
removePriority(string $name) : void
Inherited
Default properties can not be removed.
inherited_from |
\cLog::removePriority() |
Parameters
$name
string
Name of the log priority to remove
Exceptions
Empties the message buffer.
revoke() : void
Inherited
inherited_from |
\cLog::revoke() |
Sets the module to use.
setModule(int $idmod) : void
setModule automatically buffers basic module information to the log to
assist the developer in debugging his modules.
Parameters
$idmod
int
idmod The module ID to use
Exceptions
\cException |
if the module with the given idmod could not be loaded |
Defines a custom shortcut handler.
setShortcutHandler(string $shortcut, string $handler) : bool
Inherited
Each shortcut handler receives an array with the
message and the priority of the entry.
inherited_from |
\cLog::setShortcutHandler() |
Parameters
$shortcut
string
Shortcut name
$handler
string
Name of the function to call
Exceptions
Returns
bool
True if setting was successful
Sets the local writer instance.
setWriter(\cLogWriter $writer) : void
Inherited
inherited_from |
\cLog::setWriter() |
Parameters
Shortcut Handler Date.
shDate() : string
Inherited
inherited_from |
\cLog::shDate() |
Returns
string
The current date
Shortcut Handler Level.
shLevel($info) : string
Inherited
Returns the canonical name of the priority.
The canonical name is padded to 10 characters to achieve a better formatting.
inherited_from |
\cLog::shLevel() |
Parameters
$info
Returns
string
The canonical log level
Shortcut Handler Message.
shMessage($info) : string
Inherited
inherited_from |
\cLog::shMessage() |
Parameters
$info
Returns
string
The log message
Shortcut Handler Module.
shModule() : string
Returns the ID and the name of the module.
Returns
string
ID and name of the module
Unsets a specific shortcut handler.
unsetShortcutHandler(string $shortcut) : boolean
Inherited
inherited_from |
\cLog::unsetShortcutHandler() |
Parameters
$shortcut
string
Name of the shortcut
Exceptions
Returns
boolean
Properties
Contains all buffered messages
$_buffer : array
Inherited
inherited_from |
\cLog::$$_buffer |
Contains all default priorities
$_defaultPriorities : array
Inherited
inherited_from |
\cLog::$$_defaultPriorities |
Contains all available priorities
$_priorities : array
Inherited
inherited_from |
\cLog::$$_priorities |
Contains all shortcut handlers
$_shortcutHandlers : array
Inherited
inherited_from |
\cLog::$$_shortcutHandlers |
Contains the local log writer instance.
$_writer : \cLogWriter
Inherited
inherited_from |
\cLog::$$_writer |
Constants
ALERT
ALERT
Inherited
inherited_from |
\cLog::ALERT |
CRIT
CRIT
Inherited
inherited_from |
\cLog::CRIT |
DEBUG
DEBUG
Inherited
inherited_from |
\cLog::DEBUG |
EMERG
EMERG
Inherited
inherited_from |
\cLog::EMERG |
ERR
ERR
Inherited
inherited_from |
\cLog::ERR |
INFO
INFO
Inherited
inherited_from |
\cLog::INFO |
NOTICE
NOTICE
Inherited
inherited_from |
\cLog::NOTICE |
WARN
WARN
Inherited
inherited_from |
\cLog::WARN |