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
stringName of the method
$arguments
arrayArray 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
mixedwriter 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
stringName of the log priority
$value
intIndex 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
stringMessage to buffer
$priority
mixedPriority 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
booleanFlag, 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
stringMessage to log
$priority
mixedPriority 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
stringName 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
intidmod 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
stringShortcut name
$handler
stringName of the function to call
Exceptions
Returns
boolTrue 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
stringThe 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
stringThe canonical log level
Shortcut Handler Message.
shMessage($info) : string
Inherited
| inherited_from |
\cLog::shMessage() |
Parameters
$info
Returns
stringThe log message
Shortcut Handler Module.
shModule() : string
Returns the ID and the name of the module.
Returns
stringID and name of the module
Unsets a specific shortcut handler.
unsetShortcutHandler(string $shortcut) : boolean
Inherited
| inherited_from |
\cLog::unsetShortcutHandler() |
Parameters
$shortcut
stringName 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 |