Module: Logging

Included in:
Adsedare, Starship::AuthHelper, Starship::ManualTwoFactorProvider
Defined in:
lib/logging.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.configure_logger_for(classname) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/logging.rb', line 17

def configure_logger_for(classname)
  logger = ::Logger.new(STDOUT)
  logger.formatter = proc do |severity, datetime, progname, msg|
    "[AdSedare.#{progname}] [#{severity.capitalize}]: #{msg}\n"
  end
  logger.progname = classname
  logger
end

.logger_for(classname) ⇒ Object



13
14
15
# File 'lib/logging.rb', line 13

def logger_for(classname)
  @loggers[classname] ||= configure_logger_for(classname)
end

Instance Method Details

#loggerObject



6
7
8
# File 'lib/logging.rb', line 6

def logger
  @logger ||= Logging.logger_for(self.class.name)
end