mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-26 13:28:42 -05:00
Move logger instance to class var in FloatyLogger
This moves the instance of the logger class to a class variable in the `FloatyLogger` class and provides three class methods to log with in the rest of the project `FloatyLogger.info`, `FloatyLogger.warn`, and `FloatyLogger.error`.
This commit is contained in:
parent
8ec90007ca
commit
35faeab6be
7 changed files with 59 additions and 47 deletions
|
|
@ -1,6 +1,22 @@
|
|||
require 'logger'
|
||||
|
||||
class FloatyLogger < ::Logger
|
||||
def self.logger
|
||||
@@logger ||= FloatyLogger.new
|
||||
end
|
||||
|
||||
def self.info(msg)
|
||||
FloatyLogger.logger.info msg
|
||||
end
|
||||
|
||||
def self.warn(msg)
|
||||
FloatyLogger.logger.warn msg
|
||||
end
|
||||
|
||||
def self.error(msg)
|
||||
FloatyLogger.logger.error msg
|
||||
end
|
||||
|
||||
def initialize
|
||||
super(STDERR)
|
||||
self.level = ::Logger::INFO
|
||||
|
|
@ -8,4 +24,4 @@ class FloatyLogger < ::Logger
|
|||
"#{msg}\n"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue