-
-
Save KushalP/2d32eee3f45840ab5a27 to your computer and use it in GitHub Desktop.
Is there any way I can get around needing 'include Logging' for all classes that I want to expose my Logging module to?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MyModule | |
module Logging | |
def logger | |
Logging.logger | |
end | |
def self.logger | |
@logger ||= Logger.new(STDOUT) | |
end | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module MyModule | |
class Test | |
incude Logging | |
def some_method | |
do_something_here() | |
logger.debug "done something!" | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment