Closed chshersh closed 6 years ago
@ChShersh I propose to support also subloggers like node.comm
etc.
So atLogger
should parse the logger name and go to deeper level to get the logger we need.. What do you think?
@vrom911 That's a nice idea! But probably we should think more about it. With lenses it's even possible to apply them several times. So something like this is possible with atLogger
lens:
myConfig & atLogger "node" . ltSeverity ?~ warningPlus
& atLogger "node.comm" . ltSeverity ?~ debugPlus
But it won't be possible with defaultConfig
because defaultConfig
creates only single LoggerName
. So if you want to change settings for "node.comm"
you still need to create LoggerConfig
either through combination of fromScratch
, zoomLogger
and ?=
or through .yaml
file. In case if person creates LoggeConfig
through our monadic interface, he don't need this smart behavior of atLogger
lens because he don't need atLogger
lens at all.
But I still think that implementing this more smart behavior is better because such implementation makes usages of this lens more convenient.
Sometimes it happens so that you want to change default logger configuration by changing properties of some logger. For example, in order to change default severity of specified logger you need to write something like this:
This is a lot of code... It will be much more convenient, if
log-warper
provides additional helper lensPrevious example can be rewritten in much shorter way using this lens: