Documentation

Logger
in package

Logger class

Tags
category

Pop

author

Nick Sagona, III dev@nolainteractive.com

copyright

Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com)

license

http://www.popphp.org/license New BSD License

version
4.0.0

Table of Contents

Constants

ALERT  = 1
CRITICAL  = 2
DEBUG  = 7
EMERGENCY  = 0
Constants for log levels
ERROR  = 3
INFO  = 6
NOTICE  = 5
WARNING  = 4

Properties

$levels  : array<string|int, mixed>
Message level short codes
$timestampFormat  : string
Log timestamp format
$writers  : array<string|int, mixed>
Log writers

Methods

__construct()  : mixed
Constructor
addWriter()  : Logger
Add a log writer
addWriters()  : Logger
Add log writers
alert()  : Logger
Add an ALERT log entry
critical()  : Logger
Add a CRITICAL log entry
debug()  : Logger
Add a DEBUG log entry
emergency()  : Logger
Add an EMERGENCY log entry
error()  : Logger
Add an ERROR log entry
getLevel()  : string
Get level
getLogLevel()  : string
Static method to get log level
getTimestampFormat()  : string
Get timestamp format
getWriters()  : array<string|int, mixed>
Get all log writers
info()  : Logger
Add an INFO log entry
log()  : Logger
Add a log entry
notice()  : Logger
Add a NOTICE log entry
setLogLimit()  : Logger
Set log level limit for all log writers
setTimestampFormat()  : Logger
Set timestamp format
warning()  : Logger
Add a WARNING log entry

Constants

CRITICAL

public mixed CRITICAL = 2

EMERGENCY

Constants for log levels

public int EMERGENCY = 0

WARNING

public mixed WARNING = 4

Properties

$levels

Message level short codes

protected array<string|int, mixed> $levels = [0 => 'EMERGENCY', 1 => 'ALERT', 2 => 'CRITICAL', 3 => 'ERROR', 4 => 'WARNING', 5 => 'NOTICE', 6 => 'INFO', 7 => 'DEBUG']

$timestampFormat

Log timestamp format

protected string $timestampFormat = 'Y-m-d H:i:s'

$writers

Log writers

protected array<string|int, mixed> $writers = []

Methods

__construct()

Constructor

public __construct([WriterInterface|array<string|int, mixed>|null $writer = [] ][, string $timestampFormat = 'Y-m-d H:i:s' ]) : mixed

Instantiate the logger object

Parameters
$writer : WriterInterface|array<string|int, mixed>|null = []
$timestampFormat : string = 'Y-m-d H:i:s'

addWriters()

Add log writers

public addWriters(array<string|int, mixed> $writers) : Logger
Parameters
$writers : array<string|int, mixed>
Return values
Logger

alert()

Add an ALERT log entry

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

critical()

Add a CRITICAL log entry

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

debug()

Add a DEBUG log entry

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

emergency()

Add an EMERGENCY log entry

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

error()

Add an ERROR log entry

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

getLevel()

Get level

public getLevel(int $level) : string
Parameters
$level : int
Return values
string

getLogLevel()

Static method to get log level

public static getLogLevel(int $level) : string
Parameters
$level : int
Return values
string

getTimestampFormat()

Get timestamp format

public getTimestampFormat() : string
Return values
string

getWriters()

Get all log writers

public getWriters() : array<string|int, mixed>
Return values
array<string|int, mixed>

info()

Add an INFO log entry

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

log()

Add a log entry

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

notice()

Add a NOTICE log entry

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

setLogLimit()

Set log level limit for all log writers

public setLogLimit(int $level) : Logger
Parameters
$level : int
Return values
Logger

setTimestampFormat()

Set timestamp format

public setTimestampFormat([string $format = 'Y-m-d H:i:s' ]) : Logger
Parameters
$format : string = 'Y-m-d H:i:s'
Return values
Logger

warning()

Add a WARNING log entry

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

        
On this page

Search results