-
Notifications
You must be signed in to change notification settings - Fork 6
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
Dist-10392 add logging functionality #55
Changes from 4 commits
1f5809b
ae77b1f
720c96d
5131edc
a6a55a5
b12208c
2cb291b
90e6e98
92170cb
d9e8cf4
8aa2fb5
e4b399c
dc767ca
5dc146e
11281a4
72f9adb
df7fcfc
36c63c3
f1d2762
ebc1b40
3b8707f
f66682f
536f6a0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# frozen_string_literal: true | ||
|
||
require "logger" | ||
module MuffinMan | ||
class MuffinLogger | ||
def self.logger | ||
defined?(Rails) ? Rails.logger : Logger.new($stdout) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of making this gem aware of rails, we can add support for the application using the gem to set a logger. Like how Rails supports doing class << self
attr_accessor :configuration, :logger
end Then we can use the logger set by the application if one is set with MuffinMan.logger.info "a message for the logs" If no logger is set, I wonder if we default to |
||
end | ||
|
||
%i[debug info warn error fatal].each do |level| | ||
define_method(level) do |message| | ||
MuffinLogger.logger.send(level, message) | ||
end | ||
end | ||
end | ||
end |
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.
can we add this in call_api so that any api calls can use this and add enableLogging module wise?
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.
done