Properties

$log_filter

$log_filter : string

Type

string — The type of applied log filter.

$errors

$errors : array

Type

array — Error data log.

$default_log

$default_log : boolean

Type

boolean — Whether to also log all errors to PHP's default error log file.

$log_file

$log_file : string

Type

string — Path to log file.

Methods

__construct()

__construct(string  $filter, string  $path, boolean  $default_log) : void

Construct the file logger.

Parameters

string $filter

Applied log filter.

string $path

File log path.

boolean $default_log

Whether to also log all errors to PHP's default error log file.

store_error()

store_error(array  $error_data) : void

Store the error.

Store the error data associated with a faulty request in an error array.

Parameters

array $error_data

Error data.

__call()

__call(string  $name, array  $arguments) : void

Dynamically call custom logging.

Based on the method name (level), allow a user to manually log an error.

Parameters

string $name

Name of the called method.

array $arguments

Arguments of the called method.

is_using_default_log()

is_using_default_log() : boolean

Get "default log" setting.

Get whether to also log all errors to PHP's default error log file, in addition to the logger's custom file.

Returns

boolean —

Is default logger being used or not.

log()

log() : void

Log the incoming request/response pair.

Logs the incoming request and corresponding response into a file.

debug()

debug(string  $message) : void

Log a debug string.

Parameters

string $message

info()

info(string  $message) : void

Log a info string.

Parameters

string $message

warning()

warning(string  $message) : void

Log a warning.

Parameters

string $message

error()

error(string  $message) : void

Log an error.

Parameters

string $message

fatal()

fatal(string  $message) : void

Log a fatal error.

Parameters

string $message

create_log_models()

create_log_models() : void

Create log models.

Create Request and Response objects, filled with corresponding data.

process_filters()

process_filters() : array

Process filters.

Sort all filters into Request and Response filters.

Returns

array —

Sorted filter array.

map_error()

map_error(string  $name) : array

Map errors.

Map user-defined errors to their respective log levels and error codes.

Parameters

string $name

Logging level name.

Returns

array —

Log level and error code.

format_output()

format_output(array  $log) : string

Format output.

Format the desired log output.

Parameters

array $log

Log array.

Returns

string —

Formatted log string.

write_to_file()

write_to_file(string  $content) : void

Write to file.

Write the contents of a variable to the file specified by a path.

Parameters

string $content

Content to be written to the file.

log_errors()

log_errors() : void

Error-only logging.

Called when the filter parameter is set to "error"; it only logs errors, without the request and response.