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
string
Name of the method
$arguments
array
Array 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
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)
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
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() |
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
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 |