\Slim\Log
constants when setting the log level instead
of using raw integers.
The Slim application’s log object will respect or ignore logged messages based on its log level setting. When you invoke the log object’s methods, you are inherently assigning a level to the logged message. The available log levels are:
Only messages that have a level less than the current log object’s level will be logged. For example, if the log
object’s level is \Slim\Log::WARN
(5), the log object will ignore \Slim\Log::DEBUG
and \Slim\Log::INFO
messages
but will accept \Slim\Log::WARN
, \Slim\Log::ERROR
, and \Slim\Log::CRITICAL
messages.
<?php
$app->log->setLevel(\Slim\Log::WARN);
You can set the log object’s level during application instantiation, too:
<?php
$app = new \Slim\Slim(array(
'log.level' => \Slim\Log::WARN
));