Minicli provides a
Logger class that can be used to log messages to a file.
Logger class is configured via the
config/logging.php file. The following configuration keys are available:
type key defines the type of logging to be used. The following types are available:
LogType::SINGLE- A single file will be used to log all messages.
LogType::DAILY- A new file will be created for each day.
level key defines the minimum level of logging to be used. The following levels are available:
LogLevel::DEBUG- Detailed debug information.
LogLevel::INFO- Interesting events. Examples: User logs in, SQL logs.
LogLevel::WARNING- Exceptional occurrences that are not errors. Examples: Use of deprecated APIs, poor use of an API, undesirable things that are not necessarily wrong.
LogLevel::ERROR- Runtime errors that do not require immediate action but should typically be logged and monitored.
timestamp_format key defines the format of the timestamp to be used in the log messages. The default value is
Logger class is a built-in service (by implementing
ServiceInterface) resgistered as a service when the
Appclass is instanciated, allowing it to be used by the App and each command controller:
log method accepts two parameters:
$message- The message to be logged.
$level- The level of the message to be logged. The default value is the one defined in the config file.
log method, the following methods are available:
debug- Logs a message with the
info- Logs a message with the
warning- Logs a message with the
error- Logs a message with the