This class contains the main functionalities for the logging in CONTENIDO.
Examples:
$writer = cLogWriter::factory("File", array('destination' => 'contenido.log'));
$log = new cLog($writer);
$log->addPriority("CONTENIDO", 10);
$log->log("Contenido Log Message.", "CONTENIDO");
$log->contenido("Same log entry in short notation.");
$log->removePriority("CONTENIDO");
$log->emerg("System down.");
$log->log('Notice Log Message', cLog::NOTICE);
$log->buffer('Buffered Log Message', cLog::WARN);
$log->commit();
| deprecated |
2012-07-08 This class is not needed any longer. |
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
Creates a new instance of the CONTENIDO Log mechanism.
__construct($oLogger)
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
$oLogger
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)
cBufferedLog()
cBufferedLog($oLogger)
| deprecated |
[2012-05-25] Old constructor function for downwards compatibility |
Parameters
$oLogger
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() |
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
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 |