Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • PHP
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SIWECOS
    • 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 )

Constructor to create an instance of this class.

Constructor to create an instance of this class.

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 [optional] Writer object (any subclass of cLogWriter), or false if cLog should handle the writer creation

Throws

cInvalidArgumentException
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 [optional] Priority of the log entry (optional)
public boolean|
# 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 [optional] Flag, whether the buffer is cleared or not (optional, default: true)

Returns

boolean|
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 [optional] 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( array $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.

Parameters

$info
array
$info

Returns

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

Shortcut Handler Message. Returns the log message.

Shortcut Handler Message. Returns the log message.

Parameters

$info
array
$info

Returns

string
The log message
Constants summary
integer EMERG 0
#

logging level

logging level

integer ALERT 1
#

logging level

logging level

integer CRIT 2
#

logging level

logging level

integer ERR 3
#

logging level

logging level

integer WARN 4
#

logging level

logging level

integer NOTICE 5
#

logging level

logging level

integer INFO 6
#

logging level

logging level

integer DEBUG 7
#

logging level

logging level

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.10.1 API documentation generated by ApiGen 2.8.0