class Log

Joomla! Log Class

This class hooks into the global log configuration settings to allow for user configured logging events to be sent to where the user wishes them to be sent. On high load sites Syslog is probably the best (pure PHP function), then the text file based loggers (CSV, W3c or plain Formattedtext) and finally MySQL offers the most features (e.g. rapid searching) but will incur a performance hit due to INSERT being issued.

Constants

ALL

All log priorities.

EMERGENCY

The system is unusable.

ALERT

Action must be taken immediately.

CRITICAL

Critical conditions.

ERROR

Error conditions.

WARNING

Warning conditions.

NOTICE

Normal, but significant condition.

INFO

Informational message.

DEBUG

Debugging message.

Methods

static  void
add( mixed $entry, integer $priority = self::INFO, string $category = '', string $date = null, array $context = array())

Method to add an entry to the log.

static  void
addLogger( array $options, integer $priorities = self::ALL, array $categories = array(), boolean $exclude = false)

Add a logger to the Log instance. Loggers route log entries to the correct files/systems to be logged.

createDelegatedLogger()

Creates a delegated PSR-3 compatible logger from the current singleton instance. This method always returns a new delegated logger.

static  void
setInstance( Log $instance)

Returns a reference to the a Log object, only creating it if it doesn't already exist.

Details

static void add( mixed $entry, integer $priority = self::INFO, string $category = '', string $date = null, array $context = array())

Method to add an entry to the log.

Parameters

mixed $entry The LogEntry object to add to the log or the message for a new LogEntry object.
integer $priority Message priority.
string $category Type of entry
string $date Date of entry (defaults to now if not specified or blank)
array $context An optional array with additional message context.

Return Value

void

static void addLogger( array $options, integer $priorities = self::ALL, array $categories = array(), boolean $exclude = false)

Add a logger to the Log instance. Loggers route log entries to the correct files/systems to be logged.

Parameters

array $options The object configuration array.
integer $priorities Message priority
array $categories Types of entry
boolean $exclude If true, all categories will be logged except those in the $categories array

Return Value

void

static DelegatingPsrLogger createDelegatedLogger()

Creates a delegated PSR-3 compatible logger from the current singleton instance. This method always returns a new delegated logger.

Return Value

DelegatingPsrLogger

static void setInstance( Log $instance)

Returns a reference to the a Log object, only creating it if it doesn't already exist.

Note: This is principally made available for testing and internal purposes.

Parameters

Log $instance The logging object instance to be used by the static methods.

Return Value

void