Class: Vagrantomatic::Logger
- Inherits:
-
Object
- Object
- Vagrantomatic::Logger
- Defined in:
- lib/vagrantomatic/logger.rb
Overview
Logger is a class to allow for stateful and separate logs between instances by passing in individual loggers on initialisation
Instance Method Summary collapse
-
#initialize(logger = nil) ⇒ Logger
constructor
A new instance of Logger.
- #logger ⇒ Object
Constructor Details
#initialize(logger = nil) ⇒ Logger
Returns a new instance of Logger.
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/vagrantomatic/logger.rb', line 7 def initialize(logger=nil) if logger @logger = logger else @logger = ::Logger.new(STDOUT) @logger.formatter = proc do |severity, datetime, progname, msg| # depending on the source, some messages come in with new lines and # some do not so strip off any exiting and then add our own for # consistency msg = msg.strip "#{severity}: #{msg}\n" end end end |
Instance Method Details
#logger ⇒ Object
22 23 24 |
# File 'lib/vagrantomatic/logger.rb', line 22 def logger @logger end |