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 1 commit 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.
64da642 to
ee64c1b
Compare
|
@chris-olszewski missed the earlier notification. added the tests! |
chris-olszewski
left a comment
There was a problem hiding this comment.
We need to update the RBS/RBI types so a semantic logger can be used here. Updating both to take a generic Object here probably makes sense.
|
Also, do you have control of @rogerwang-boop and could get it to sign the CLA? |
2e89e34 to
c0c9d8e
Compare
`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`.
c0c9d8e to
c62040c
Compare
|
@chris-olszewski added RBS/RBI sig changes. Also fixed the state of the branch ( @rogerwang-boop merged main instead of rebasing). |
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: