Skip to content

classes_essentials_logging_logger.class

Daniel Spors edited this page Nov 14, 2024 · 3 revisions

Classes in file essentials/logging/logger.class.php

class Logger

Base class for logging. Do not use this directly but the functions in logging.php instead. Will ensure that logging information is writte to specified files. Will also take care of rotating the logs and cleaning up old logfiles.

Subclasses: CliLogger, TraceLogger

addCategory

Adds a category

Definition: public function addCategory($name)

Returns: void

Parameters:

  • string $name Category to add

debug

SHORTCUT Logs to severity DEBUG

error

SHORTCUT Logs to severity ERROR

extend

Extends the log filename.

Definition: public function extend($key, $value)

Returns: void

Parameters:

  • string $key Key to use

  • string $value Value to use

fatal

SHORTCUT Logs to severity FATAL

Get

Instanciates and return a Logger from a given config.

Definition: public static function Get($config)

Returns: mixed The logger, may be of type Logger or whatever is specified in $config['class']

Parameters:

  • array $config Logger configuration data

hasCategory

Checks for a category

Definition: public function hasCategory($name)

Returns: bool Whether the category is set or not

Parameters:

  • string $name Category to check for

info

SHORTCUT Logs to severity INFO

removeCategory

Removes a category

Definition: public function removeCategory($name)

Returns: void

Parameters:

  • string $name Category to remove

report

Writes a LogReport to the log. See LogReport class and log_start_report/log_report for details.

Definition: public function report(LogReport $report, $severity, $log_trace=true)

Returns: void

Parameters:

  • LogReport $report The report

  • string $severity Severity to use

  • bool $log_trace Append a trace (see debug_backtrace)

RotateNow

Forces log rotation.

Definition: public function RotateNow()

Returns: void

trace

SHORTCUT Logs to severity TRACE

warn

SHORTCUT Logs to severity WARN

write

Writes a log entry.

Definition: public function write($severity=false, $log_trace=false, $args)

Returns: void

Parameters:

  • string $severity Severity

  • bool $log_trace If true appends a trace (see debug_backtrace).

  • mixed $args Data to be logged

__construct

Definition: protected function __construct($config)

Returns: NOT DOCUMENTED

Parameters:

  • $config NOT DOCUMENTED
Clone this wiki locally