-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add ContextLogger that accepts data as second argument to log method #79
Conversation
@timstott @FundingCircle/prod-ops 👀 |
c414b93
to
d9d4d50
Compare
@@ -46,25 +46,29 @@ def compute_service_version | |||
end | |||
|
|||
def initialize_logger | |||
unless device | |||
raise 'Please specify device for the Loga logger' |
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.
Is it necessary to raise an exception considering we're logging the error below?
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.
Otherwise it will be NoMethodError
on the next line.
https://github.com/FundingCircle/loga/blob/master/spec/unit/loga/configuration_spec.rb#L50
Is there a reason not to default to e.g. device ||= $stdout
here?
@bliof it's looking good. I'm going to do some additional review locally 🙇 |
d9d4d50
to
f0521a9
Compare
f0521a9
to
6f4ab4b
Compare
6f4ab4b
to
f80a498
Compare
@timstott 💭 Logging to |
3b754c7
to
8e11ee6
Compare
d1a276f
to
a6a46fc
Compare
7f8f148
to
5bf0458
Compare
There are some special fields https://github.com/FundingCircle/loga/blob/master/lib/loga/event.rb#L3 |
5bf0458
to
f3bf9fe
Compare
ContextLogger.info('test') ContextLogger.info('test', user_id: 123, test_arg: 12) ContextLogger.info('test') { 'test message' } ContextLogger.info('test') { ['test message', test_arg: 1235] }
f3bf9fe
to
76090d1
Compare
@timstott What are we going to do with this PR? :) 👍 / 👎 |
@bliof while I understand and support the ambition of this PR, I am not keen on introducing backwards incompatible change. Removing Loga from an application should only be the matter of removing the dependency in the Gemfile and the configuration. |
@timstott You have to send me a photo of that board :D Here are 2 ideas:
|
This PR tries to resolve #77
In rails the
ContextLogger
is returned byRails.logger
. I think that this is not ok and we should return that logger when doingLoga.logger
and return a normal logger when doingRails.logger
. Comments :) ?