Module: SSO::Logging

Overview

One thing tha bugs me is when I cannot see which part of the code caused a log message. This mixin will include the current class name as Logger ‘progname` so you can show that it in your logfiles.

Instance Method Summary collapse

Instance Method Details

#debug(&block) ⇒ Object



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

def debug(&block)
  logger && logger.debug(progname, &block)
end

#error(&block) ⇒ Object



19
20
21
# File 'lib/sso/logging.rb', line 19

def error(&block)
  logger && logger.error(progname, &block)
end

#fatal(&block) ⇒ Object



23
24
25
# File 'lib/sso/logging.rb', line 23

def fatal(&block)
  logger && logger.fatal(progname, &block)
end

#info(&block) ⇒ Object



11
12
13
# File 'lib/sso/logging.rb', line 11

def info(&block)
  logger && logger.info(progname, &block)
end

#loggerObject



31
32
33
# File 'lib/sso/logging.rb', line 31

def logger
  ::SSO.config.logger
end

#prognameObject



27
28
29
# File 'lib/sso/logging.rb', line 27

def progname
  self.class.name
end

#warn(&block) ⇒ Object



15
16
17
# File 'lib/sso/logging.rb', line 15

def warn(&block)
  logger && logger.warn(progname, &block)
end