Since: 1.7.0

class FormattedtextLogger extends Logger

Joomla! Formatted Text File Log class

This class is designed to use as a base for building formatted text files for output. By default it emulates the Syslog style format output. This is a disk based output format.

Properties

protected array Since: 3.0.1
$options

Options array for the Log instance.

from  Logger
protected array Since: 3.0.1
$priorities

Translation array for LogEntry priorities to text strings.

from  Logger
protected string Since: 1.7.0
$format

The format which each entry follows in the log file.

protected array Since: 1.7.0
$fields

The parsed fields from the format string.

protected string Since: 1.7.0
$path

The full filesystem path for the log file.

protected bool Since: 3.9.0
$defer

If true, all writes will be deferred as long as possible.

protected array Since: 3.9.0
$deferredEntries

If deferring, entries will be stored here prior to writing.

Methods

__construct(array $options)

Constructor.

void
addEntry(LogEntry $entry)

Method to add an entry to the log.

__destruct()

If deferred, write all pending logs.

__wakeup()

Prevent object injection attacks by suppressing unserialization of instance with deferred rows

string
formatLine(LogEntry $entry)

Format a line for the log file.

string
generateFileHeader()

Method to generate the log file header.

void
initFile()

Method to initialise the log file. This will create the folder path to the file if it doesn't already exist and also get a new file header if the file doesn't already exist. If the file already exists it will simply open it for writing.

void
parseFields()

Method to parse the format string into an array of fields.

Details

__construct(array $options)

Since: 1.7.0

Constructor.

Parameters

array $options

Log object options.

void addEntry(LogEntry $entry)

Since: 1.7.0

Method to add an entry to the log.

Parameters

LogEntry $entry

The log entry object to add to the log.

Return Value

void

Exceptions

RuntimeException

__destruct()

Since: 3.9.0

If deferred, write all pending logs.

__wakeup()

Since: 5.2.2

Prevent object injection attacks by suppressing unserialization of instance with deferred rows

Exceptions

Exception

protected string formatLine(LogEntry $entry)

Since: 3.9.0

Format a line for the log file.

Parameters

LogEntry $entry

The log entry to format as a string.

Return Value

string

protected string generateFileHeader()

Since: 1.7.0

Method to generate the log file header.

Return Value

string

The log file header

protected void initFile()

Since: 1.7.0

Method to initialise the log file. This will create the folder path to the file if it doesn't already exist and also get a new file header if the file doesn't already exist. If the file already exists it will simply open it for writing.

Return Value

void

Exceptions

RuntimeException

protected void parseFields()

Since: 1.7.0

Method to parse the format string into an array of fields.

Return Value

void