module MrLogaLoga::InstanceMethods

Description

Instance methods to be attached when including the main module.

@api private

Public Instance Methods

loga_context() click to toggle source
# File lib/mr_loga_loga/instance_methods.rb, line 10
def loga_context
  { class_name: self.class.name }
end
loga_loga() click to toggle source

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

# 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
logger() click to toggle source

A shorthand method to use in your classes

# File lib/mr_loga_loga/instance_methods.rb, line 15
def logger
  if loga_loga.is_a?(MrLogaLoga::Logger)
    MrLogaLoga::LoggerProxy.new(loga_loga, -> { loga_context })
  else
    loga_loga
  end
end