Module: OmfCommon::DefaultLogging

Defined in:
lib/omf_common/default_logging.rb

Instance Method Summary collapse

Instance Method Details

#debug(*args, &block) ⇒ Object

See Also:



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

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

#error(*args, &block) ⇒ Object

See Also:



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

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

#fatal(*args, &block) ⇒ Object

See Also:



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

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'


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

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

#warn(*args, &block) ⇒ Object

See Also:



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

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



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

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



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

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