Answer the question
In order to leave comments, you need to log in
Is there an easy way to expand the number of logging levels (yii2)?
without pandemonium with redefinition of everything and everything
confuses in \yii\log\Target base
public function setLevels($levels)
{
static $levelMap = [
'error' => Logger::LEVEL_ERROR,
'warning' => Logger::LEVEL_WARNING,
'info' => Logger::LEVEL_INFO,
'trace' => Logger::LEVEL_TRACE,
'profile' => Logger::LEVEL_PROFILE,
];
if (is_array($levels)) {
$this->_levels = 0;
foreach ($levels as $level) {
if (isset($levelMap[$level])) {
$this->_levels |= $levelMap[$level];
} else {
throw new InvalidConfigException("Unrecognized level: $level");
}
}
} else {
$this->_levels = $levels;
}
}
Answer the question
In order to leave comments, you need to log in
The number of logging levels is actually set in your application's config, namely in the `traceLevel` parameter of the `log` component:
'log' => [
'traceLevel' => 3,
],
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question