Logs
in package
Logging System Class
This class provides a flexible logging system that allows for organizing logs into groups, with different message types and optional parameter storage. It can also automatically track the file path that generated each log entry.
Tags
Table of Contents
Methods
- cleanStr() : string
- Clean string before saving to log
- get() : mixed
- Returns the saved message group
- logStr() : string
- Cleans a log string that was modified with cleanStr
- set() : void
- Adds a log entry to a log group
Methods
cleanStr()
Clean string before saving to log
public
static cleanStr(string $string) : string
Parameters
- $string : string
Return values
stringget()
Returns the saved message group
public
static get(string $group) : mixed
Parameters
- $group : string
logStr()
Cleans a log string that was modified with cleanStr
public
static logStr(string $string) : string
Parameters
- $string : string
Return values
stringset()
Adds a log entry to a log group
public
static set(string $group, string $msgType[, string $msg = "" ][, mixed $params = "" ][, bool|array<string|int, mixed> $path = true ]) : void
This method creates a new log entry and stores it in the specified group. It can optionally include additional parameters and automatically track the file path that generated the log entry.
Parameters
- $group : string
-
The log group name (also used as filename when writing to disk)
- $msgType : string
-
The message type (free text, typically uppercase like 'ERROR', 'INFO')
- $msg : string = ""
-
Optional message text to log
- $params : mixed = ""
-
Optional parameters to store with the log entry
- $path : bool|array<string|int, mixed> = true
-
Whether to include file paths that led to this log call, or custom paths