mirror of
https://github.com/puppetlabs/vmfloaty.git
synced 2026-01-26 05:28:40 -05:00
(DIO-908) Adding a way to set Logger level via --loglevel
this is specially useful if you also use in combination --json to remove superfluous stdout
This commit is contained in:
parent
a3d8484124
commit
4192631d70
2 changed files with 30 additions and 0 deletions
|
|
@ -17,6 +17,19 @@ class FloatyLogger < ::Logger
|
|||
FloatyLogger.logger.error msg
|
||||
end
|
||||
|
||||
def self.setlevel=(level)
|
||||
level = level.downcase
|
||||
if level == "debug"
|
||||
self.logger.level = ::Logger::DEBUG
|
||||
elsif level == "info"
|
||||
self.logger.level = ::Logger::INFO
|
||||
elsif level == "error"
|
||||
self.logger.level = ::Logger::ERROR
|
||||
else
|
||||
error("set loglevel to debug, info or error")
|
||||
end
|
||||
end
|
||||
|
||||
def initialize
|
||||
super(STDERR)
|
||||
self.level = ::Logger::INFO
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue