Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Success/warning/etc messages are not shown after update to 1.3.0, if loglevel is info #33

Closed
olelis opened this issue Jan 16, 2024 · 1 comment

Comments

@olelis
Copy link
Contributor

olelis commented Jan 16, 2024

Hello,

after update to 1.3.0, all channels except info are not shown.

You can actually run examples/logging.php to see that only debug message will be shown.

I would expect that when you select logging level to "debug" to see all messages ,while if I set to emergency, then to see only "emergency" errors. Currently it works in the opposite way: Emergency shows everything, debug show only debug messages.

Reason is in this method:

  public function setLogLevel($level)
   {
       if (!isset($this->loglevel[$level])) $this->fatal('Unknown log level');
       $enable = true;
       foreach (array_keys($this->loglevel) as $l) {
           $this->loglevel[$l]['enabled'] = $enable;
           if ($l == $level) $enable = false;
       }
   }

Order of loglevels should be reversed, or $enabled should be false by default.

@olelis
Copy link
Contributor Author

olelis commented Jan 16, 2024

Current workaround is to set logdefault to emergency, instead of info.
protected $logdefault = 'emergency';

splitbrain added a commit that referenced this issue Jan 17, 2024
splitbrain added a commit that referenced this issue Jan 17, 2024
* olelis-master:
  Fixes issue #33: setLogLevel works in reversed order
splitbrain added a commit that referenced this issue Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant