T4LOG
in package
implements
LoggerInterface
Table of Contents
Interfaces
- LoggerInterface
Constants
- PRIORITY_ALERT : 1 = LOG_ALERT
- PRIORITY_CRIT : 2 = 2
- PRIORITY_DEBUG : 40 = 40
- PRIORITY_DEFAULT : 1 = LOG_ALERT
- PRIORITY_DEV : 44 = 44
- PRIORITY_EMERG : 0 = 0
- PRIORITY_ERR : 4 = LOG_ERR
- PRIORITY_INFO : 3 = 3
- PRIORITY_NORMAL : 6 = LOG_NOTICE
- PRIORITY_NOTICE : 6 = LOG_NOTICE
- PRIORITY_WARNING : 5 = LOG_WARNING
Properties
- $LOG_ROOT_DEV_DIR : string
- $LOG_ROOT_DIR : string
- $after : string
- $before : string
- $logFileDevScheme : string
- $logFileScheme : string
- $logScheme : string
- $message : string
- $sepparator : string
- $startScheme : string
- $stopScheme : string
- $datetime : string
- $datetimeFile : string
- $nameLogFile : string
- $nameLogFileT4LOG : string
- $params : array<string|int, mixed>
- $priority : int
- $systemLog : bool|string
- $systemLogSocket : mixed
Methods
- __construct() : mixed
- __destruct() : mixed
- alert() : void
- Logs with an arbitrary level.
- crit() : void
- Logs with an arbitrary level.
- critical() : void
- Logs with an arbitrary level.
- debug() : void
- Logs with an arbitrary level.
- dev() : void
- Logs with an arbitrary level.
- emerg() : void
- Logs with an arbitrary level.
- emergency() : void
- Logs with an arbitrary level.
- err() : void
- Logs with an arbitrary level.
- error() : void
- Logs with an arbitrary level.
- getDatetime() : mixed
- getLogScheme() : string
- getMessage() : string
- getParams() : array<string|int, mixed>
- info() : void
- Logs with an arbitrary level.
- log() : void
- Logs with an arbitrary level.
- logT() : T4LOG
- notice() : void
- Logs with an arbitrary level.
- on() : void
- setDatetime() : T4LOG
- setLogScheme() : T4LOG
- setMessage() : T4LOG
- setParams() : T4LOG
- setStartScheme() : T4LOG
- setStopScheme() : T4LOG
- sys() : void
- Logs with an arbitrary level.
- warning() : void
- Logs with an arbitrary level.
- contextParse() : string
- paramParse() : string|bool
- priorityParse() : string
- saveLog() : bool
- validatePriority() : bool
- filterFillName() : string
- Filters special characters from a file name or path.
- santanizeFileName() : string
- t4LOGLooger() : bool
- Logs application start/stop events to the specified log file.
Constants
PRIORITY_ALERT
public
1
PRIORITY_ALERT
= LOG_ALERT
Tags
PRIORITY_CRIT
public
2
PRIORITY_CRIT
= 2
Tags
PRIORITY_DEBUG
public
40
PRIORITY_DEBUG
= 40
Tags
PRIORITY_DEFAULT
public
1
PRIORITY_DEFAULT
= LOG_ALERT
Tags
PRIORITY_DEV
public
44
PRIORITY_DEV
= 44
Tags
PRIORITY_EMERG
public
0
PRIORITY_EMERG
= 0
Tags
PRIORITY_ERR
public
4
PRIORITY_ERR
= LOG_ERR
Tags
PRIORITY_INFO
public
3
PRIORITY_INFO
= 3
Tags
PRIORITY_NORMAL
public
6
PRIORITY_NORMAL
= LOG_NOTICE
Tags
PRIORITY_NOTICE
public
6
PRIORITY_NOTICE
= LOG_NOTICE
Tags
PRIORITY_WARNING
public
5
PRIORITY_WARNING
= LOG_WARNING
Tags
Properties
$LOG_ROOT_DEV_DIR
public
static string
$LOG_ROOT_DEV_DIR
= "dev{{DIRECTORY_SEPARATOR}}"
$LOG_ROOT_DIR
public
static string
$LOG_ROOT_DIR
= __DIR__ . "..{{DIRECTORY_SEPARATOR}}..{{DIRECTORY_SEPARATOR}}runtime{{DIRECTORY_SEPARATOR}}log{{DIRECTORY_SEPARATOR}}"
$after
protected
string
$after
= ""
$before
protected
string
$before
= ""
$logFileDevScheme
protected
string
$logFileDevScheme
= "{{date_file}}_{{php_version}}.t4log"
$logFileScheme
protected
string
$logFileScheme
= "{{date_file}}_{{php_version}}.log"
$logScheme
protected
string
$logScheme
= "{{datetime}} {{sepparator}} [{{prefix}}] {{before}} {{message}} {{after}} {{sepparator}} {{file}}::{{line}}" . " |{{ip}}| {{sepparator}} {{php_version}} {{sepparator}} {{system_user}}/{{os}}/{{os_family}}"
$message
protected
string
$message
= "APP:LOG >>"
$sepparator
protected
string
$sepparator
= "-"
$startScheme
protected
string
$startScheme
= "{{datetime}} {{sepparator}} [{{prefix}}][START:APP] {{before}} {{message}} {{after}} {{sepparator}} " . "{{php_version}}::{{php_version_id}} {{sepparator}} {{system_user}}/{{os}}/{{os_family}} {{sepparator}} " . "{{php_config_file_path}} {{pear_install_dir}}"
$stopScheme
protected
string
$stopScheme
= "{{datetime}} {{sepparator}} [{{prefix}}][STOP:APP] {{before}} {{message}} {{after}} {{sepparator}} " . "{{php_version}}::{{php_version_id}} {{sepparator}} {{system_user}}/{{os}}/{{os_family}} {{sepparator}} " . "{{php_config_file_path}} {{pear_install_dir}}"
$datetime
private
string
$datetime
= DATE_ATOM
$datetimeFile
private
string
$datetimeFile
= "d_m_Y"
$nameLogFile
private
string
$nameLogFile
$nameLogFileT4LOG
private
string
$nameLogFileT4LOG
$params
private
array<string|int, mixed>
$params
= []
$priority
private
int
$priority
= self::PRIORITY_DEFAULT
$systemLog
private
bool|string
$systemLog
= false
$systemLogSocket
private
mixed
$systemLogSocket
Methods
__construct()
public
__construct([array<string|int, mixed> $params = [] ]) : mixed
Parameters
- $params : array<string|int, mixed> = []
__destruct()
public
__destruct() : mixed
alert()
Logs with an arbitrary level.
public
alert(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
crit()
Logs with an arbitrary level.
public
crit(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
critical()
Logs with an arbitrary level.
public
critical(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
debug()
Logs with an arbitrary level.
public
debug(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
dev()
Logs with an arbitrary level.
public
dev(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
emerg()
Logs with an arbitrary level.
public
emerg(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
emergency()
Logs with an arbitrary level.
public
emergency(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
err()
Logs with an arbitrary level.
public
err(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
error()
Logs with an arbitrary level.
public
error(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
getDatetime()
public
getDatetime() : mixed
getLogScheme()
public
getLogScheme() : string
Return values
stringgetMessage()
public
getMessage() : string
Return values
stringgetParams()
public
getParams() : array<string|int, mixed>
Return values
array<string|int, mixed>info()
Logs with an arbitrary level.
public
info(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
log()
Logs with an arbitrary level.
public
log(int $level, string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $level : int
- $message : string
- $context : array<string|int, mixed> = []
logT()
public
logT(int $priority, string $message) : T4LOG
Parameters
- $priority : int
- $message : string
Return values
T4LOGnotice()
Logs with an arbitrary level.
public
notice(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
on()
public
on(int $priority, string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $priority : int
- $message : string
- $context : array<string|int, mixed> = []
setDatetime()
public
setDatetime(mixed $datetime) : T4LOG
Parameters
- $datetime : mixed
Return values
T4LOGsetLogScheme()
public
setLogScheme(string $logScheme) : T4LOG
Parameters
- $logScheme : string
Return values
T4LOGsetMessage()
public
setMessage(string $message) : T4LOG
Parameters
- $message : string
Return values
T4LOGsetParams()
public
setParams(array<string|int, mixed> $params) : T4LOG
Parameters
- $params : array<string|int, mixed>
Return values
T4LOGsetStartScheme()
public
setStartScheme(string $startScheme) : T4LOG
Parameters
- $startScheme : string
Return values
T4LOGsetStopScheme()
public
setStopScheme(string $stopScheme) : T4LOG
Parameters
- $stopScheme : string
Return values
T4LOGsys()
Logs with an arbitrary level.
public
sys(int $facility, string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $facility : int
- $message : string
- $context : array<string|int, mixed> = []
-
The
facilityargument is used to specify what type of program is logging the message. This lets the configuration file specify that messages from different facilities will be handled differently. Must be one of the following constants:LOG_AUTHLOG_AUTHPRIVLOG_CRONLOG_DAEMONLOG_KERNLOG_LOCAL[0-7]LOG_LPRLOG_MAILLOG_NEWSLOG_SYSLOGLOG_USERLOG_UUCPNote : This parameter is ignored on Windows.
warning()
Logs with an arbitrary level.
public
warning(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
contextParse()
protected
contextParse(string $scheme, array<string|int, mixed>|object $context) : string
Parameters
- $scheme : string
- $context : array<string|int, mixed>|object
Return values
stringparamParse()
protected
paramParse(mixed $log[, int|null $priority = null ][, string|null $message = null ]) : string|bool
Parameters
- $log : mixed
- $priority : int|null = null
- $message : string|null = null
Return values
string|boolpriorityParse()
protected
priorityParse([int|null $priority = null ]) : string
Parameters
- $priority : int|null = null
Return values
stringsaveLog()
protected
saveLog(int $priority, string $message[, array<string|int, mixed> $context = [] ][, string|null $scheme = null ][, bool|null $stering = null ][, bool $nativeSystemLog = false ]) : bool
Parameters
- $priority : int
- $message : string
- $context : array<string|int, mixed> = []
- $scheme : string|null = null
- $stering : bool|null = null
- $nativeSystemLog : bool = false
Return values
boolvalidatePriority()
protected
validatePriority([int|null $priority = null ]) : bool
Parameters
- $priority : int|null = null
Return values
boolfilterFillName()
Filters special characters from a file name or path.
private
filterFillName(string $raw) : string
This function removes or replaces characters that are not safe for use in file systems. It's designed to prevent potential issues with file creation or access due to invalid characters.
Parameters
- $raw : string
-
The input string (file name or path) to be filtered.
Return values
string —The filtered string, safe for use as a file name or path component.
santanizeFileName()
private
santanizeFileName(string $raw) : string
Parameters
- $raw : string
Return values
stringt4LOGLooger()
Logs application start/stop events to the specified log file.
private
t4LOGLooger(string $EGV) : bool
Parameters
- $EGV : string
-
The event type, e.g., "START" or "STOP".
Return values
bool —True on success, false on failure.