Properties

$errorList

$errorList : array

Type

array — - Predefined list of errors, useful for locale messages

$namespace

$namespace : string

Type

string — - Stores the Log instance internal namespace fro logs

$currentChannel

$currentChannel : string

Type

string — - Stores the current selected channel

$console

$console : array

Type

array — The console to store all logs

Methods

__construct()

__construct(string $namespace, \ptejada\uFlex\Log $logLink)

Initializes a new log instance with the options to set an initial namespace

Parameters

string $namespace
\ptejada\uFlex\Log $logLink

changeNamespace()

changeNamespace(mixed $namespace) : $this

Change the current namespace

Parameters

mixed $namespace

Returns

$this

hasError()

hasError() : bool

Checks the current channel for errors

Returns

bool

getFullConsole()

getFullConsole() : array

Get the full console array

Returns

array

getErrors()

getErrors(string $channel) : array

Get all errors in a specified channel

Parameters

string $channel
  • Channel identifier

Returns

array —
  • returns the error stack by reference, even if empty

getAllErrors()

getAllErrors() : array

Get all logged errors per channel

Returns

array

getReports()

getReports(string $channel) : array

Get all the report for the current channel or an specific channel

Parameters

string $channel
  • (optional) Channel name

Returns

array

getAllReports()

getAllReports() : array

Get all logged errors per channel

Returns

array

formError()

formError(string $field, string|int $message) : $this

Log an error to a form field error Note: Only one error per field in a channel namespace

Parameters

string $field
  • The form field name
string|int $message
  • The error message to link to the field or an ID of a predefined error message

Returns

$this

error()

error(string|int $message) : $this

Log an error

Parameters

string|int $message
  • An error message to log or the index of a predefined error

Returns

$this

report()

report(mixed $message) : $this

Logs a process report

Parameters

mixed $message

Returns

$this

getFormErrors()

getFormErrors(string $channel) : array

Get form errors by channel

Parameters

string $channel
  • (optional) Channel to look for form errors in, if omitted the current channel is used

Returns

array

getAllFormErrors()

getAllFormErrors() : array

Get all the form errors in the console groups by nameSpaced channels

Returns

array

updateErrorList()

updateErrorList(array $errors)

Updates the predefined list of errors Note: The method self::error() which uses the predefined error list only support numeric indexes

Parameters

array $errors
  • Array of error messages

channel()

channel(mixed $channelName) : $this

Change the current channel Note: note changing to a channel with existing errors from previous calls will be cleared

Parameters

mixed $channelName

Returns

$this

clearErrors()

clearErrors(string $channelName)

Clears existing errors for a channel

Parameters

string $channelName

getNamespace()

getNamespace() : string

Get the current namespace

Returns

string

newChildLog()

newChildLog(mixed $namespace) : \ptejada\uFlex\Log

Creates a new instance of Log with a linked console

Parameters

mixed $namespace

Returns

\ptejada\uFlex\Log

addPredefinedError()

addPredefinedError(int|array $id, string $message)

Adds a predefined error to the internal list

Parameters

int|array $id

Must be numeric or associative array with numeric keys

string $message

namespaceChannel()

namespaceChannel(mixed $channelName) : string

Converts a plain channel name into a namespace channel identifier

Parameters

mixed $channelName

Returns

string

cleanConsole()

cleanConsole()

Removes any empty namespace of the current channel from the console