class AnsiConsoleBackend extends ConsoleBackend (View source)

Extended ANSI console backend with human friendly formatting

Constants

FG_BLACK

FG_WHITE

FG_GRAY

FG_BLUE

FG_CYAN

FG_YELLOW

FG_RED

FG_GREEN

BG_CYAN

BG_GREEN

BG_RED

BG_YELLOW

BG_WHITE

END

Properties

protected int $severityThreshold

One of the LOG_* constants. Anything below that will be filtered out.

from  AbstractBackend
protected bool $logIpAddress

Flag telling if the IP address of the current client (if available) should be logged.

from  AbstractBackend
protected array $severityLabels

An array of severity labels, indexed by their integer constant

from  ConsoleBackend
protected string $streamName

Stream name to use (stdout, stderr)

from  ConsoleBackend
protected resource $streamHandle from  ConsoleBackend
protected array $tagFormats
protected bool $disableAnsi

Methods

__construct(mixed $options = [])

Constructs this log backend

void
setSeverityThreshold(int $severityThreshold)

The maximum severity to log, anything less severe will not be logged.

void
setLogIpAddress(bool $logIpAddress)

Enables or disables logging of IP addresses.

void
open()

Open the log backend

void
append(string $message, int $severity = LOG_INFO, mixed $additionalData = null, string $packageKey = null, string $className = null, string $methodName = null)

Appends the given message along with the additional information into the log.

void
close()

Carries out all actions necessary to cleanly close the logging backend, such as closing the log file or disconnecting from a database.

string
formatOutput(string $output)

Apply ansi formatting to output according to tags

setDisableAnsi(bool $disableAnsi)

No description

bool
getDisableAnsi()

No description

Details

__construct(mixed $options = [])

Constructs this log backend

Parameters

mixed $options

Configuration options - depends on the actual backend

void setSeverityThreshold(int $severityThreshold)

The maximum severity to log, anything less severe will not be logged.

Parameters

int $severityThreshold

One of the LOG_* constants

Return Value

void

void setLogIpAddress(bool $logIpAddress)

Enables or disables logging of IP addresses.

Parameters

bool $logIpAddress

Set to true to enable logging of IP address, or false to disable

Return Value

void

void open()

Open the log backend

Initializes tag formats.

Return Value

void

Exceptions

CouldNotOpenResourceException

void append(string $message, int $severity = LOG_INFO, mixed $additionalData = null, string $packageKey = null, string $className = null, string $methodName = null)

Appends the given message along with the additional information into the log.

Parameters

string $message

The message to log

int $severity

One of the LOG_* constants

mixed $additionalData

A variable containing more information about the event to be logged

string $packageKey

Key of the package triggering the log (determined automatically if not specified)

string $className

Name of the class triggering the log (determined automatically if not specified)

string $methodName

Name of the method triggering the log (determined automatically if not specified)

Return Value

void

void close()

Carries out all actions necessary to cleanly close the logging backend, such as closing the log file or disconnecting from a database.

Note: for this backend we do nothing here and rely on PHP to close the stream handle when the request ends. This is to allow full logging until request end.

revise upon resolution of http://forge.typo3.org/issues/9861

Return Value

void

protected string formatOutput(string $output)

Apply ansi formatting to output according to tags

Parameters

string $output

Return Value

string

setDisableAnsi(bool $disableAnsi)

No description

Parameters

bool $disableAnsi

bool getDisableAnsi()

No description

Return Value

bool