-
-
Notifications
You must be signed in to change notification settings - Fork 15
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
Added interested levels support #8
Conversation
It was passing messages to PSR logger as is. |
The list of levels can be specified in the config, but this does not lead to anything. I thought that it's better to implement the functionality than to mislead the developer. I tried to use SlackHandler only for certain levels, but I could not. Now this problem is solved. |
You can, of course, define levels in the Rsr handler, but if I want to log only the TRACE level, then I get PROFILE levels too. |
Yes. It makes sense to add it. Please fix code (see travis build fail). |
src/PsrTarget.php
Outdated
/** | ||
* @var array | ||
*/ | ||
private $_interestedLevels = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to specify = null
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be named _levels
similar to base Target
class.
src/PsrTarget.php
Outdated
public function init() | ||
{ | ||
parent::init(); | ||
if (is_null($this->_interestedLevels)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need for this check. At init()
state it will be null all the time.
src/PsrTarget.php
Outdated
/** | ||
* @var array | ||
*/ | ||
private $_interestedLevels = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could be named _levels
similar to base Target
class.
src/PsrTarget.php
Outdated
{ | ||
parent::init(); | ||
if (is_null($this->_interestedLevels)) { | ||
$this->_interestedLevels = $this->_psrLevels; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that by default there should be both PSR and non-PSR levels. Would simplify code significantly.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not quite understand the point. You mean the division into PSR and non-PSR levels?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean $this->_interestedLevels = [all PSR and Yii levels here]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, _psrLevels will duplicate _levels. I left only _levels.
*/ | ||
public function setLevels($levels) | ||
{ | ||
static $levelMap = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That would disallow using PSR levels in setLevels(). Is that intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why? _levels contains the PSR levels. I need to write tests for this.
Merged. Thanks! |
Earlier definition of the list of levels of logging for target in any way did not influence its work.