Module: KStor::Log

Defined in:
lib/kstor/log.rb,
lib/kstor/log/simple_logger.rb,
lib/kstor/log/systemd_logger.rb

Overview

rubocop:disable Style/Documentation

Defined Under Namespace

Classes: SimpleLogger

Constant Summary collapse

DEBUG =

rubocop:enable Style/Documentation

Journald::LOG_DEBUG
INFO =
Journald::LOG_INFO
WARN =
Journald::LOG_WARNING
ERROR =
Journald::LOG_ERR

Class Method Summary collapse

Class Method Details

.alert(msg) ⇒ Object

Log an alert message.



59
60
61
# File 'lib/kstor/log.rb', line 59

def alert(msg)
  logger.alert(msg)
end

.create_loggerObject

Create new systemd journald logger



78
79
80
# File 'lib/kstor/log/simple_logger.rb', line 78

def create_logger
  SimpleLogger.new
end

.critical(msg) ⇒ Object

Log a critical error message.



52
53
54
# File 'lib/kstor/log.rb', line 52

def critical(msg)
  logger.critical(msg)
end

.debug(msg) ⇒ Object

Log a debug message.



17
18
19
# File 'lib/kstor/log.rb', line 17

def debug(msg)
  logger.debug(msg)
end

.emergency(msg) ⇒ Object

Log an emergency message.



66
67
68
# File 'lib/kstor/log.rb', line 66

def emergency(msg)
  logger.emergency(msg)
end

.error(msg) ⇒ Object

Log an error message.



45
46
47
# File 'lib/kstor/log.rb', line 45

def error(msg)
  logger.error(msg)
end

.exception(exc) ⇒ Object

Log an exception.



10
11
12
# File 'lib/kstor/log.rb', line 10

def exception(exc)
  logger.exception(exc)
end

.info(msg) ⇒ Object

Log an informative message.



24
25
26
# File 'lib/kstor/log.rb', line 24

def info(msg)
  logger.info(msg)
end

.notice(msg) ⇒ Object

Log a notice message.



31
32
33
# File 'lib/kstor/log.rb', line 31

def notice(msg)
  logger.notice(msg)
end

.reporting_level=(lvl) ⇒ Object

Set reporting level.



71
72
73
74
75
76
77
78
79
# File 'lib/kstor/log.rb', line 71

def reporting_level=(lvl)
  lvl = level_str_to_int(lvl) if lvl.respond_to?(:to_str)

  if logger.respond_to?(:min_priority)
    logger.min_priority = lvl
  else
    logger.level = lvl
  end
end

.warn(msg) ⇒ Object

Log a warning.



38
39
40
# File 'lib/kstor/log.rb', line 38

def warn(msg)
  logger.warn(msg)
end