Class: KStor::Log::SimpleLogger Private

Inherits:
Object
  • Object
show all
Defined in:
lib/kstor/log/simple_logger.rb

Overview

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

Simple logger using Ruby Logger.

It just defines some convenient methods that Journald::Logger has.

Instance Method Summary collapse

Constructor Details

#initializeKStor::Log::SimpleLogger

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.

Create a new logger.



19
20
21
# File 'lib/kstor/log/simple_logger.rb', line 19

def initialize
  @logger = Logger.new($stdout)
end

Instance Method Details

#debug(msg) ⇒ Object

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.

Log a debug message.

Parameters:

  • msg (String)

    message



33
34
35
# File 'lib/kstor/log/simple_logger.rb', line 33

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

#error(msg) ⇒ Object Also known as: critical, alert, emergency

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.

Log an error message.

Parameters:

  • msg (String)

    message



54
55
56
# File 'lib/kstor/log/simple_logger.rb', line 54

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

#exception(exc) ⇒ Object

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.

Log an exception with full backtrace and all.

Parameters:

  • exc (Exception)

    an exception



61
62
63
# File 'lib/kstor/log/simple_logger.rb', line 61

def exception(exc)
  @logger.error(exc.full_message)
end

#info(msg) ⇒ Object Also known as: notice

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.

Log an informative message.

Parameters:

  • msg (String)

    message



40
41
42
# File 'lib/kstor/log/simple_logger.rb', line 40

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

#level=(lvl) ⇒ Object

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.

Set minimum log level

Parameters:

  • lvl (Integer)

    log level from constants in Logger class



26
27
28
# File 'lib/kstor/log/simple_logger.rb', line 26

def level=(lvl)
  @logger.level = lvl
end

#warn(msg) ⇒ Object

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.

Log a warning.

Parameters:

  • msg (String)

    message



47
48
49
# File 'lib/kstor/log/simple_logger.rb', line 47

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