Module: Logging

Overview

include this to add ability to log at different levels

Instance Method Summary collapse

Instance Method Details

#debug(message = nil, &block) ⇒ void

This method returns an undefined value.

Parameters:

  • message (String, nil) (defaults to: nil)


42
43
44
# File 'lib/checkoff/internal/logging.rb', line 42

def debug(message = nil, &block)
  logger.debug(message, &block)
end

#error(message = nil, &block) ⇒ void

This method returns an undefined value.

Parameters:

  • message (String, nil) (defaults to: nil)


21
22
23
# File 'lib/checkoff/internal/logging.rb', line 21

def error(message = nil, &block)
  logger.error(message, &block)
end

#finer(message = nil, &block) ⇒ void

This method returns an undefined value.

Parameters:

  • message (String, nil) (defaults to: nil)


49
50
51
52
53
# File 'lib/checkoff/internal/logging.rb', line 49

def finer(message = nil, &block)
  # No such level by default
  #
  # logger.finer(message, &block)
end

#info(message = nil, &block) ⇒ void

This method returns an undefined value.

Parameters:

  • message (String, nil) (defaults to: nil)


35
36
37
# File 'lib/checkoff/internal/logging.rb', line 35

def info(message = nil, &block)
  logger.info(message, &block)
end

#logger::Logger

Returns:

  • (::Logger)


8
9
10
11
12
13
14
15
16
# File 'lib/checkoff/internal/logging.rb', line 8

def logger
  # @sg-ignore
  @logger ||= if defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger
                # @sg-ignore
                Rails.logger
              else
                ::Logger.new($stdout, level: log_level)
              end
end

#warn(message = nil, &block) ⇒ void

This method returns an undefined value.

Parameters:

  • message (String, nil) (defaults to: nil)


28
29
30
# File 'lib/checkoff/internal/logging.rb', line 28

def warn(message = nil, &block)
  logger.warn(message, &block)
end