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
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • 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
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • cLog
  • cLogWriter
  • cLogWriterFile
  • cModuleLog
  • Overview
  • Package
  • Class
  • Todo
  • Download

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
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
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
Shortcut name
$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
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
Message to buffer
$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
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
Message to log
$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
Name of the log priority
$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
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
Name of the method
$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( $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( $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

Contains all shortcut handlers

Contains all shortcut handlers

# array()
protected array $_priorities

Contains all available priorities

Contains all available priorities

# array()
protected array $_defaultPriorities

Contains all default priorities

Contains all default priorities

# array()
protected array $_buffer

Contains all buffered messages

Contains all buffered messages

# array()
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen