-
Notifications
You must be signed in to change notification settings - Fork 2
2001/no jira passion logger with context #12
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
2001/no jira passion logger with context #12
Conversation
20c165b
to
24df4fb
Compare
…legate to logger for level
|
||
it "merges context" do | ||
subject.fatal("fatal message", call_id: "234-123") | ||
expect(log_stream.string).to match(/\{"message":"fatal message","severity":"FATAL","timestamp":".*","log_source":"redis_client","call_id":"234-123"\}/) |
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.
Metrics/LineLength: Line is too long. [157/150]
@jebentier The contract change I mentioned on the screen share: 13bd8dd?utf8=%E2%9C%93&diff=split&w=1 |
require 'rubygems' | ||
require 'bundler/setup' | ||
|
||
|
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.
Layout/EmptyLines: Extra blank line detected.
@@ -0,0 +1,14 @@ | |||
#!/usr/bin/env rake |
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.
Lint/ScriptPermission: Script file Rakefile doesn't have execute permission.
@jebentier Can you please review the changes I just pushed? |
Introduces new
LoggerWithContext
class. Example usage:Now the redis_client gem will be logging at the DEBUG level (regardless of
logger
's level) and all its log messages will be tagged withlog_source = redis_client
. With no changes required to theredis_client
gem! :)Factory shorthand for the above that snaps to the logger's
level
:LoggerMixin
that implements thelevel
and thedebug
,info
...fatal
methods so those can be used in both places.