make scoped logger work with logger objects with non-int level - #486
make scoped logger work with logger objects with non-int level#486HoneyryderChuck wants to merge 2 commits into
Conversation
|
|
|
|
d587d28 to
df7793c
Compare
chris-olszewski
left a comment
There was a problem hiding this comment.
Please add some testing that exersices against Semantic Logger
df7793c to
64da642
Compare
chris-olszewski
left a comment
There was a problem hiding this comment.
There is still no testing against an actual semantic logger. I would feel far more comfortable with this change if we had some sort of regression testing to make sure our scoped logger is compatible.
`Logger#level` returns an integer, however many other logger libraries in ruby land don't do that, most notably semantic_logger, which is nowadays recommended by rails for structured logging; `SemanticLogger::Logger` objects return `#level` as a symbol (ex: `:info`). This patch fixes it by allowing a escape hatch for non-integer levels; just call `#upcase` (which both strings and symbols support) and pass it to `Logger::Severity.const_get`.
64da642 to
ee64c1b
Compare
|
@chris-olszewski missed the earlier notification. added the tests! |
What was changed
This patch fixes scoped loggers by allowing a escape hatch for logger objects with non-integer levels; just call
#upcase(which both strings and symbols support) and pass it toLogger::Severity.const_get.Why?
Logger#levelreturns an integer, however many other logger libraries in ruby land don't do that, most notably semantic_logger, which is nowadays recommended by rails for structured logging;SemanticLogger::Loggerobjects return#levelas a symbol (ex::info).Checklist
Closes [Bug] Does not support semantic_logger #472
How was this tested: