Module: MrLogaLoga::InstanceMethods Private

Defined in:
lib/mr_loga_loga/instance_methods.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Description

Instance methods to be attached when including the main module.

Instance Method Summary collapse

Instance Method Details

#loga_contextObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



10
11
12
# File 'lib/mr_loga_loga/instance_methods.rb', line 10

def loga_context
  { class_name: self.class.name }
end

#loga_logaObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Define the underlying logger to be used. Overwrite this to use a specific logger instance



24
25
26
27
28
29
30
# File 'lib/mr_loga_loga/instance_methods.rb', line 24

def loga_loga
  @loga_loga ||= if defined?(Rails.logger)
                   Rails.logger
                 else
                   MrLogaLoga.configuration.logger
                 end
end

#loggerObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

A shorthand method to use in your classes



15
16
17
18
19
20
21
# File 'lib/mr_loga_loga/instance_methods.rb', line 15

def logger
  if loga_loga.is_a?(MrLogaLoga::Logger)
    loga_loga.context { loga_context }
  else
    loga_loga
  end
end