Documentation

SimpleLogger extends AbstractLogger
in package

Table of Contents

Constants

RFC5424_LEVELS  = [\Psr\Log\LogLevel::EMERGENCY => 0, \Psr\Log\LogLevel::ALERT => 1, \Psr\Log\LogLevel::CRITICAL => 2, \Psr\Log\LogLevel::ERROR => 3, \Psr\Log\LogLevel::WARNING => 4, \Psr\Log\LogLevel::NOTICE => 5, \Psr\Log\LogLevel::INFO => 6, \Psr\Log\LogLevel::DEBUG => 7]

Properties

$absoluteFilePath  : string
$logFormat  : string
$logLevel  : string
$logStore  : array<string|int, mixed>
$type  : LoggerType

Methods

__construct()  : mixed
log()  : void
logStore()  : string|array<string|int, mixed>
setLogFormat()  : void
createLine()  : string
formatException()  : string
formatObject()  : string
interpolate()  : string
isException()  : bool
validateLevel()  : void
writeLine()  : void
writeLineToFile()  : void
writeToErrorLog()  : void

Constants

RFC5424_LEVELS

public mixed RFC5424_LEVELS = [\Psr\Log\LogLevel::EMERGENCY => 0, \Psr\Log\LogLevel::ALERT => 1, \Psr\Log\LogLevel::CRITICAL => 2, \Psr\Log\LogLevel::ERROR => 3, \Psr\Log\LogLevel::WARNING => 4, \Psr\Log\LogLevel::NOTICE => 5, \Psr\Log\LogLevel::INFO => 6, \Psr\Log\LogLevel::DEBUG => 7]

Properties

$absoluteFilePath read-only

private string $absoluteFilePath

$logFormat

private string $logFormat = '[{datetime}] [{level}] {message}'

$logStore

private array<string|int, mixed> $logStore = []

Methods

__construct()

public __construct([LoggerType $type = LoggerType::ERROR_LOG ][, string $logLevel = LogLevel::DEBUG ][, string $absoluteFilePath = '' ]) : mixed
Parameters
$type : LoggerType = LoggerType::ERROR_LOG
$logLevel : string = LogLevel::DEBUG
$absoluteFilePath : string = ''

log()

public log(mixed $level, string|Stringable $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
$level : mixed
$message : string|Stringable
$context : array<string|int, mixed> = []

logStore()

public logStore([bool $asString = true ]) : string|array<string|int, mixed>
Parameters
$asString : bool = true
Return values
string|array<string|int, mixed>

setLogFormat()

public setLogFormat(string $logFormat) : void
Parameters
$logFormat : string

createLine()

private createLine(string $level, string $message) : string
Parameters
$level : string
$message : string
Return values
string

formatException()

private formatException(Throwable $exception) : string
Parameters
$exception : Throwable
Return values
string

formatObject()

private formatObject(object $object) : string
Parameters
$object : object
Return values
string

interpolate()

private interpolate(string $message, array<string|int, mixed> $context) : string
Parameters
$message : string
$context : array<string|int, mixed>
Return values
string

isException()

private isException(string $key, mixed $exception) : bool
Parameters
$key : string
$exception : mixed
Return values
bool

validateLevel()

private validateLevel(string $level) : void
Parameters
$level : string

writeLine()

private writeLine(string $line) : void
Parameters
$line : string

writeLineToFile()

private writeLineToFile(string $line) : void
Parameters
$line : string

writeToErrorLog()

private writeToErrorLog(string $line) : void
Parameters
$line : string

        
On this page

Search results