Overview

Packages

  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Datatype
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationMain
    • NavigationTop
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob

Classes

  • cLog
  • cLogWriter
  • cLogWriterFile
  • cModuleLog
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  • Todo

Class cLog

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();

Direct known subclasses

cModuleLog
Package: Core\Log
Copyright: four for business AG <www.4fb.de>
License: http://www.contenido.org/license/LIZENZ.txt
Author: Dominik Ziegler
Located at classes/log/class.log.php
Methods summary
public
# __construct( mixed $writer = false )

Creates a new instance of the CONTENIDO Log mechanism.

Creates a new instance of the CONTENIDO Log mechanism.

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
public cLogWriter
# getWriter( )

Returns the local writer instance.

Returns the local writer instance.

Returns

cLogWriter
public
# setWriter( cLogWriter $writer )

Sets the local writer instance.

Sets the local writer instance.

Parameters

$writer
cLogWriter
$writer Writer instacne
public boolean
# setShortcutHandler( string $shortcut, string $handler )

Defines a custom shortcut handler.

Defines a custom shortcut handler.

Each shortcut handler receives an array with the message and the priority of the entry.

Parameters

$shortcut
string
$shortcut Shortcut name
$handler
string
$handler Name of the function to call

Returns

boolean
True if setting was successful

Throws

cInvalidArgumentException
if the given shortcut is empty or already in use or if the handler is not callable
public boolean
# unsetShortcutHandler( string $shortcut )

Unsets a specific shortcut handler.

Unsets a specific shortcut handler.

Parameters

$shortcut
string
$shortcut Name of the shortcut

Returns

boolean

Throws

cInvalidArgumentException
if the given shortcut handler does not exist
public
# buffer( string $message, mixed $priority = NULL )

Buffers a log message for committing them on a later moment.

Buffers a log message for committing them on a later moment.

Parameters

$message
string
$message Message to buffer
$priority
mixed
$priority Priority of the log entry (optional)
public
# commit( boolean $revoke = true )

Commits all buffered messages and empties the message buffer if parameter is not false.

Commits all buffered messages and empties the message buffer if parameter is not false.

Parameters

$revoke
boolean
$revoke Flag, whether the buffer is cleared or not (optional, default: true)
public
# revoke( )

Empties the message buffer.

Empties the message buffer.

public
# log( string $message, mixed $priority = NULL )

Logs a message using the local writer instance

Logs a message using the local writer instance

Parameters

$message
string
$message Message to log
$priority
mixed
$priority Priority of the log entry (optional)
public
# addPriority( string $name, integer $value )

Adds a new priority to the log.

Adds a new priority to the log.

Parameters

$name
string
$name Name of the log priority
$value
integer
$value Index value of the log priority

Throws

cInvalidArgumentException
if the given name is empty, already exists or the value already exists
public
# removePriority( string $name )

Removes a priority from log. Default properties can not be removed.

Removes a priority from log. Default properties can not be removed.

Parameters

$name
string
$name Name of the log priority to remove

Throws

cInvalidArgumentException
if the given name is empty, does not exist or is a default priority
public
# __call( string $method, array $arguments )

Magic call method for direct priority named calls.

Magic call method for direct priority named calls.

Parameters

$method
string
$method Name of the method
$arguments
array
$arguments Array with the method arguments

Throws

cInvalidArgumentException
if the given priority is not supported
public string
# shDate( )

Shortcut Handler Date. Returns the current date

Shortcut Handler Date. Returns the current date

Returns

string
The current date
public string
# shLevel( mixed $info )

Shortcut Handler Level. Returns the canonical name of the priority. The canonical name is padded to 10 characters to achieve a better formatting.

Shortcut Handler Level. Returns the canonical name of the priority. The canonical name is padded to 10 characters to achieve a better formatting.

Returns

string
The canonical log level
public string
# shMessage( mixed $info )

Shortcut Handler Message. Returns the log message.

Shortcut Handler Message. Returns the log message.

Returns

string
The log message
Constants summary
integer EMERG 0
#
integer ALERT 1
#
integer CRIT 2
#
integer ERR 3
#
integer WARN 4
#
integer NOTICE 5
#
integer INFO 6
#
integer DEBUG 7
#
Properties summary
protected cLogWriter $_writer
#

Contains the local log writer instance.

Contains the local log writer instance.

protected array $_shortcutHandlers array()
#

Contains all shortcut handlers

Contains all shortcut handlers

protected array $_priorities array()
#

Contains all available priorities

Contains all available priorities

protected array $_defaultPriorities array()
#

Contains all default priorities

Contains all default priorities

protected array $_buffer array()
#

Contains all buffered messages

Contains all buffered messages

CMS CONTENIDO 4.9.0 API documentation generated by ApiGen 2.8.0