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
|
|
@ -109,8 +109,8 @@ class Utils
|
|||
raise "Invalid service type #{service.type}"
|
||||
end
|
||||
rescue StandardError => e
|
||||
Vmfloaty.logger.error("Something went wrong while trying to gather information on #{hostname}:")
|
||||
Vmfloaty.logger.error(e)
|
||||
FloatyLogger.error("Something went wrong while trying to gather information on #{hostname}:")
|
||||
FloatyLogger.error(e)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -134,7 +134,7 @@ class Utils
|
|||
char = 'o'
|
||||
puts "#{name.ljust(width)} #{(char * ready).green}#{(char * pending).yellow}#{(char * missing).red}"
|
||||
rescue StandardError => e
|
||||
Vmfloaty.logger.error "#{name.ljust(width)} #{e.red}"
|
||||
FloatyLogger.error "#{name.ljust(width)} #{e.red}"
|
||||
end
|
||||
end
|
||||
puts message.colorize(status_response['status']['ok'] ? :default : :red)
|
||||
|
|
@ -153,11 +153,11 @@ class Utils
|
|||
char = 'o'
|
||||
puts "#{name.ljust(width)} #{(char * ready).green}#{(char * pending).yellow}#{(char * missing).red}"
|
||||
rescue StandardError => e
|
||||
Vmfloaty.logger.error "#{name.ljust(width)} #{e.red}"
|
||||
FloatyLogger.error "#{name.ljust(width)} #{e.red}"
|
||||
end
|
||||
end
|
||||
when 'ABS'
|
||||
Vmfloaty.logger.error 'ABS Not OK' unless status_response
|
||||
FloatyLogger.error 'ABS Not OK' unless status_response
|
||||
puts 'ABS is OK'.green if status_response
|
||||
else
|
||||
raise "Invalid service type #{service.type}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue