Class: RFacter::Util::Logger Private

Inherits:
Logger
  • Object
show all
Defined in:
lib/rfacter/util/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.

RFacter Logger class

This class provides all the methods of a standard Ruby Logger plus the following methods used by the Facter API:

- `warnonce`
- `debugonce`
- `log_exception`

Since:

  • 0.1.0

Constant Summary collapse

@@warn_messages =

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

Since:

  • 0.1.0

Hash.new
@@debug_messages =

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

Since:

  • 0.1.0

Hash.new

Instance Method Summary collapse

Instance Method Details

#debugonce(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.

Since:

  • 0.1.0



27
28
29
30
31
32
# File 'lib/rfacter/util/logger.rb', line 27

def debugonce(msg)
  if @@debug_messages[msg].nil?
    self.debug(msg)
    @@debug_messages[msg] = true
  end
end

#log_exception(exception, message = nil) ⇒ 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.

Since:

  • 0.1.0



34
35
36
37
38
39
40
41
42
# File 'lib/rfacter/util/logger.rb', line 34

def log_exception(exception, message = nil)
  message = exception.message if message.nil?

  output = []
  output << message
  output.concat(exception.backtrace)

  self.warn(output.flatten.join("\n"))
end

#warnonce(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.

Since:

  • 0.1.0



20
21
22
23
24
25
# File 'lib/rfacter/util/logger.rb', line 20

def warnonce(msg)
  if @@warn_messages[msg].nil?
    self.warn(msg)
    @@warn_messages[msg] = true
  end
end