Log
in package
Table of Contents
- $logger : LoggerInterface|null
- alert() : void
- Log an alert message.
- createLogFile() : void
- Ensure that a log file exists. If the file or its parent directories do not exist, this function will create them.
- critical() : void
- Log a critical message.
- debug() : void
- Log a debug message.
- emergency() : void
- Log an emergency message.
- error() : void
- Log an error message.
- info() : void
- Log an informational message.
- init() : void
- Initializes the logger with an optional file path. If no file path is provided, it will fall back to error_log.
- notice() : void
- Log a notice message.
- warning() : void
- Log a warning message.
- getLogger() : null|LoggerInterface
- Ensure that the logger is initialized and return the logger instance.
Properties
$logger
private
static LoggerInterface|null
$logger
= null
Methods
alert()
Log an alert message.
public
static alert(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
Return values
void —createLogFile()
Ensure that a log file exists. If the file or its parent directories do not exist, this function will create them.
public
static createLogFile(string $logFile) : void
Parameters
- $logFile : string
-
The path to the log file.
Tags
Return values
void —critical()
Log a critical message.
public
static critical(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
Return values
void —debug()
Log a debug message.
public
static debug(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
Return values
void —emergency()
Log an emergency message.
public
static emergency(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
Return values
void —error()
Log an error message.
public
static error(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
Return values
void —info()
Log an informational message.
public
static info(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
Return values
void —init()
Initializes the logger with an optional file path. If no file path is provided, it will fall back to error_log.
public
static init([null|LoggerInterface $logger = null ]) : void
Parameters
- $logger : null|LoggerInterface = null
Return values
void —notice()
Log a notice message.
public
static notice(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
Return values
void —warning()
Log a warning message.
public
static warning(string $message[, array<string|int, mixed> $context = [] ]) : void
Parameters
- $message : string
- $context : array<string|int, mixed> = []
Return values
void —getLogger()
Ensure that the logger is initialized and return the logger instance.
private
static getLogger() : null|LoggerInterface