Module: ShareDataWatcher::Loggable

Included in:
ShareDataWatcher, Type::Base
Defined in:
lib/share-data-watcher/loggable.rb

Overview

Logger Module

Instance Method Summary collapse

Instance Method Details

#debug(string) ⇒ Object



10
11
12
# File 'lib/share-data-watcher/loggable.rb', line 10

def debug(string)
  ShareDataWatcher.logger&.debug(string)
end

#error(err) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/share-data-watcher/loggable.rb', line 18

def error(err)
  logger = ShareDataWatcher.logger
  case err
  when StandardError
    logger&.error(
      err: "#{err.class}:#{err.message}",
      backtrace: err.backtrace.join("\n")
    )
  else
    logger&.error err
  end
end

#info(string) ⇒ Object



6
7
8
# File 'lib/share-data-watcher/loggable.rb', line 6

def info(string)
  ShareDataWatcher.logger&.info(string)
end

#warn(string) ⇒ Object



14
15
16
# File 'lib/share-data-watcher/loggable.rb', line 14

def warn(string)
  ShareDataWatcher.logger&.warn(string)
end