Class: Mixlib::Log::Logger::LocklessLogDevice
- Inherits:
-
LogDevice
- Object
- LogDevice
- Mixlib::Log::Logger::LocklessLogDevice
- Defined in:
- lib/mixlib/log/logger.rb
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(log = nil) ⇒ LocklessLogDevice
constructor
A new instance of LocklessLogDevice.
- #write(message) ⇒ Object
Constructor Details
#initialize(log = nil) ⇒ LocklessLogDevice
Returns a new instance of LocklessLogDevice.
60 61 62 63 64 65 66 67 68 69 |
# File 'lib/mixlib/log/logger.rb', line 60 def initialize(log = nil) @dev = @filename = @shift_age = @shift_size = nil if log.respond_to?(:write) && log.respond_to?(:close) @dev = log else @dev = open_logfile(log) @filename = log end @dev.sync = true end |
Instance Method Details
#close ⇒ Object
77 78 79 |
# File 'lib/mixlib/log/logger.rb', line 77 def close @dev.close rescue nil end |
#write(message) ⇒ Object
71 72 73 74 75 |
# File 'lib/mixlib/log/logger.rb', line 71 def write() @dev.write() rescue Exception => ignored warn("log writing failed. #{ignored}") end |