Methods for logging stuff to Syslog.
More...
|
static | log ( $message, $priority=LOG_INFO, $label=null) |
| Log a message string to Syslog.
|
|
static | logEx (Exception $ex, $additionalText='', $priority=LOG_ERR, $label=null) |
| Log an exception to Syslog.
|
|
static | popLabel () |
| Go back to the last label.
|
|
static | pushLabel ( $label) |
| By pushing a label, you change the sub identifier string for each message logged after the string was pushed.
|
|
static | setBucket ( $bucket) |
| Set the process Syslog thinks this is.
|
|
static | setContext ( $context) |
| A string that will be added to the front of every log message regardless of the current label.
|
|
|
static string | $bucket = '' |
| What process to tell syslog the message came from.
|
|
static string | $context = '' |
| A persistent string prepended to all messages.
|
|
static self | $inst = null |
| The global instance of the Syslog class.
|
|
static string[] | $label = [ '' ] |
| A stack of strings, whatever is on the top of the stack will get prepended to the message.
|
|
Methods for logging stuff to Syslog.
Definition at line 32 of file Logger.php.
◆ __construct()
◆ log()
static Logger::log |
( |
| $message, |
|
|
| $priority = LOG_INFO, |
|
|
| $label = null ) |
|
static |
Log a message string to Syslog.
- Parameters
-
string | $message | The string to log |
int | $priority | The syslog priority to log this message at |
string | null | $label | When pushing/popping a label would be too much work |
Definition at line 55 of file Logger.php.
◆ logEx()
static Logger::logEx |
( |
Exception | $ex, |
|
|
| $additionalText = '', |
|
|
| $priority = LOG_ERR, |
|
|
| $label = null ) |
|
static |
Log an exception to Syslog.
The stack trace will be included as a JSON string.
- Parameters
-
Exception | $ex | The exception |
string | $additionalText | Any string to also log as context, default is empty |
int | $priority | The syslog priority to log this message at, default ERR |
string | null | $label | When pushing/popping a label would be too much work |
Definition at line 72 of file Logger.php.
◆ logString()
Logger::logString |
( |
| $msgText, |
|
|
| $pri, |
|
|
| $label = null ) |
|
private |
Perform the actual log operation.
- Parameters
-
string | $msgText | |
int | $pri | |
string | null | $label | |
Definition at line 141 of file Logger.php.
◆ popLabel()
static Logger::popLabel |
( |
| ) |
|
|
static |
Go back to the last label.
Definition at line 131 of file Logger.php.
◆ pushLabel()
static Logger::pushLabel |
( |
| $label | ) |
|
|
static |
By pushing a label, you change the sub identifier string for each message logged after the string was pushed.
- Parameters
-
Definition at line 123 of file Logger.php.
◆ setBucket()
static Logger::setBucket |
( |
| $bucket | ) |
|
|
static |
Set the process Syslog thinks this is.
This is just a string that gets prepended to the log message by the Syslog utility. Can be used for very cheap bucketing of logs.
- Parameters
-
Definition at line 101 of file Logger.php.
◆ setContext()
static Logger::setContext |
( |
| $context | ) |
|
|
static |
A string that will be added to the front of every log message regardless of the current label.
Use it for things like request IDs.
- Parameters
-
Definition at line 112 of file Logger.php.
◆ $bucket
string Logger::$bucket = '' |
|
staticprivate |
What process to tell syslog the message came from.
Definition at line 38 of file Logger.php.
◆ $context
string Logger::$context = '' |
|
staticprivate |
A persistent string prepended to all messages.
Definition at line 40 of file Logger.php.
◆ $inst
self Logger::$inst = null |
|
staticprivate |
The global instance of the Syslog class.
Definition at line 35 of file Logger.php.
◆ $label
string [] Logger::$label = [ '' ] |
|
staticprivate |
A stack of strings, whatever is on the top of the stack will get prepended to the message.
Definition at line 42 of file Logger.php.
The documentation for this class was generated from the following file:
- extensions/FundraisingEmailUnsubscribe/includes/Logger.php