Aplus Framework Docs

FileLogger extends Logger
in package

Class FileLogger.

Table of Contents

$config  : array<string|int, mixed>
$debugCollector  : LogCollector
$destination  : string
Logs destination.
$lastLog  : Log|null
$level  : LogLevel
Active log level.
__construct()  : mixed
Logger constructor.
getDestination()  : string
getLastLog()  : Log|null
Get the last accepted log in the current instance.
getLevel()  : LogLevel
log()  : bool
Logs with an arbitrary level.
logAlert()  : bool
Action must be taken immediately.
logCritical()  : bool
Critical conditions.
logDebug()  : bool
Detailed debug information.
logEmergency()  : bool
System is unusable.
logError()  : bool
Runtime errors that do not require immediate action but should typically be logged and monitored.
logInfo()  : bool
Interesting events.
logNotice()  : bool
Normal but significant events.
logWarning()  : bool
Exceptional occurrences that are not errors.
setDebugCollector()  : static
setLevel()  : static
getConfig()  : array<string|int, mixed>
makeId()  : string
replaceContext()  : string
setConfig()  : static
setDestination()  : static
write()  : bool

Properties

$config

protected array<string|int, mixed> $config

$destination

Logs destination.

protected string $destination

$level

Active log level.

protected LogLevel $level = \Framework\Log\LogLevel::DEBUG

Methods

__construct()

Logger constructor.

public __construct(string $destination[, int|LogLevel $level = LogLevel::DEBUG ][, array<string|int, mixed> $config = [] ]) : mixed
Parameters
$destination : string
$level : int|LogLevel = LogLevel::DEBUG
$config : array<string|int, mixed> = []
Return values
mixed

getDestination()

public getDestination() : string
Return values
string

getLastLog()

Get the last accepted log in the current instance.

public getLastLog() : Log|null
Return values
Log|null

The last Log or null if the last was not accepted

log()

Logs with an arbitrary level.

public log(int|LogLevel $level, string $message[, array<string|int, string> $context = [] ]) : bool
Parameters
$level : int|LogLevel
$message : string
$context : array<string|int, string> = []
Return values
bool

logAlert()

Action must be taken immediately.

public logAlert(string $message[, array<string|int, string> $context = [] ]) : bool

Example: Entire website down, database unavailable, etc. This should trigger the SMS alerts and wake you up.

Parameters
$message : string
$context : array<string|int, string> = []
Return values
bool

logCritical()

Critical conditions.

public logCritical(string $message[, array<string|int, string> $context = [] ]) : bool

Example: Application component unavailable, unexpected exception.

Parameters
$message : string
$context : array<string|int, string> = []
Return values
bool

logDebug()

Detailed debug information.

public logDebug(string $message[, array<string|int, string> $context = [] ]) : bool
Parameters
$message : string
$context : array<string|int, string> = []
Return values
bool

logEmergency()

System is unusable.

public logEmergency(string $message[, array<string|int, string> $context = [] ]) : bool
Parameters
$message : string
$context : array<string|int, string> = []
Return values
bool

logError()

Runtime errors that do not require immediate action but should typically be logged and monitored.

public logError(string $message[, array<string|int, string> $context = [] ]) : bool
Parameters
$message : string
$context : array<string|int, string> = []
Return values
bool

logInfo()

Interesting events.

public logInfo(string $message[, array<string|int, string> $context = [] ]) : bool

Example: User logs in, SQL logs.

Parameters
$message : string
$context : array<string|int, string> = []
Return values
bool

logNotice()

Normal but significant events.

public logNotice(string $message[, array<string|int, string> $context = [] ]) : bool
Parameters
$message : string
$context : array<string|int, string> = []
Return values
bool

logWarning()

Exceptional occurrences that are not errors.

public logWarning(string $message[, array<string|int, string> $context = [] ]) : bool

Example: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.

Parameters
$message : string
$context : array<string|int, string> = []
Return values
bool

setDebugCollector()

public setDebugCollector(LogCollector $debugCollector) : static
Parameters
$debugCollector : LogCollector
Return values
static

setLevel()

public setLevel(LogLevel|int $level) : static
Parameters
$level : LogLevel|int
Return values
static

getConfig()

protected getConfig() : array<string|int, mixed>
Return values
array<string|int, mixed>

makeId()

protected makeId() : string
Return values
string

replaceContext()

protected replaceContext(string $message, array<string|int, string> $context) : string
Parameters
$message : string
$context : array<string|int, string>
Return values
string

setConfig()

protected setConfig(array<string|int, mixed> $config) : static
Parameters
$config : array<string|int, mixed>
Return values
static

setDestination()

protected setDestination(string $destination) : static
Parameters
$destination : string
Return values
static

write()

protected write(Log $log) : bool
Parameters
$log : Log
Return values
bool

Search results