Module: OmfCommon::DefaultLogging

Defined in:
omf_common/lib/omf_common/default_logging.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) debug(*args, &block)

See Also:



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

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

- (Object) error(*args, &block)

See Also:



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

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

- (Object) fatal(*args, &block)

See Also:



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

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

- (Object) get_logger(name = nil) (private)



65
66
67
# File 'omf_common/lib/omf_common/default_logging.rb', line 65

def get_logger(name = nil)
  name.nil? ? logger : Logging::Logger["#{logger.name}::#{name.to_s}"]
end

- (Object) info(*args, &block)

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 'omf_common/lib/omf_common/default_logging.rb', line 28

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

- (Object) warn(*args, &block)

See Also:



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

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

- (Object) warn_deprecation(deprecated_name, *suggest_names)

Log a warning message for deprecated methods



53
54
55
# File 'omf_common/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

- (Object) warn_removed(deprecated_name)



57
58
59
60
61
# File 'omf_common/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