Module: OmfCommon::DefaultLogging

Defined in:
lib/omf_common/default_logging.rb

Instance Method Summary collapse

Instance Method Details

#debug(*args, &block) ⇒ Object

See Also:



33
34
35
# File 'lib/omf_common/default_logging.rb', line 33

def debug(*args, &block)
  get_logger(args[1]).debug(args[0], &block)
end

#error(*args, &block) ⇒ Object

See Also:



38
39
40
# File 'lib/omf_common/default_logging.rb', line 38

def error(*args, &block)
  get_logger(args[1]).error(args[0], &block)
end

#fatal(*args, &block) ⇒ Object

See Also:



43
44
45
# File 'lib/omf_common/default_logging.rb', line 43

def fatal(*args, &block)
  get_logger(args[1]).fatal(args[0], &block)
end

#info(*args, &block) ⇒ Object

Alias logging method using default logger

Examples:


info 'Information'
# Additional logger name will generate a new child logger in the context of default logger
info 'Information', 'logger name'


28
29
30
# File 'lib/omf_common/default_logging.rb', line 28

def info(*args, &block)
  get_logger(args[1]).info(args[0], &block)
end

#warn(*args, &block) ⇒ Object

See Also:



48
49
50
# File 'lib/omf_common/default_logging.rb', line 48

def warn(*args, &block)
  get_logger(args[1]).warn(args[0], &block)
end

#warn_deprecation(deprecated_name, *suggest_names) ⇒ Object

Log a warning message for deprecated methods



53
54
55
# File 'lib/omf_common/default_logging.rb', line 53

def warn_deprecation(deprecated_name, *suggest_names)
  logger.warn "[DEPRECATION] '#{deprecated_name}' is deprecated. Please use '#{suggest_names.join(', ')}' instead."
end

#warn_removed(deprecated_name) ⇒ Object



57
58
59
60
61
# File 'lib/omf_common/default_logging.rb', line 57

def warn_removed(deprecated_name)
  define_method(deprecated_name) do |*args, &block|
    logger.warn "[DEPRECATION] '#{deprecated_name}' is deprecated and not supported. Please do not use it."
  end
end