Module: Contrast::Logger::AliasedLogging

Defined in:
lib/contrast/logger/aliased_logging.rb

Overview

Our decorator for the Ougai logger allowing for the catching, creating and saving Telemetry exceptions

Constant Summary collapse

ALIASED_WARN =
'warn'.cs__freeze
ALIASED_ERROR =
'error'.cs__freeze
ALIASED_FATAL =
'fatal'.cs__freeze

Instance Method Summary collapse

Instance Method Details

#error(message = nil, exception = nil, data = nil, &block) ⇒ Object

Parameters:

  • message (String) (defaults to: nil)

    The message to log. Use default_message if not specified.

  • exception (Exception) (defaults to: nil)

    The exception or the error

  • data (Object) (defaults to: nil)

    Any structured data



26
27
28
29
30
# File 'lib/contrast/logger/aliased_logging.rb', line 26

def error message = nil, exception = nil, data = nil, &block
  # build Telemetry Exclusion
  build_exception(ALIASED_ERROR, message, exception, data)
  super(message, exception, data, &block)
end

#fatal(message = nil, exception = nil, data = nil, &block) ⇒ Object

Parameters:

  • message (String) (defaults to: nil)

    The message to log. Use default_message if not specified.

  • exception (Exception) (defaults to: nil)

    The exception or the error

  • data (Object) (defaults to: nil)

    Any structured data



35
36
37
38
39
# File 'lib/contrast/logger/aliased_logging.rb', line 35

def fatal message = nil, exception = nil, data = nil, &block
  # build Telemetry Exclusion
  build_exception(ALIASED_FATAL, message, exception, data)
  super(message, exception, data, &block)
end

#warn(message = nil, exception = nil, data = nil, &block) ⇒ Object

Parameters:

  • message (String) (defaults to: nil)

    The message to log. Use default_message if not specified.

  • exception (Exception) (defaults to: nil)

    The exception or the error

  • data (Object) (defaults to: nil)

    Any structured data



17
18
19
20
21
# File 'lib/contrast/logger/aliased_logging.rb', line 17

def warn message = nil, exception = nil, data = nil, &block
  # build Telemetry Exclusion
  build_exception(ALIASED_WARN, message, exception, data)
  super(message, exception, data, &block)
end