Module: VirtualBox::Logger
- Included in:
- AbstractModel, COM::FFIInterface, COM::Implementer::Base
- Defined in:
- lib/virtualbox/ext/logger.rb
Overview
Provides logger functionality for VirtualBox. This class is available on most VirtualBox classes through mixins. To access the logger, simply call the #logger method. This returns a standard Ruby logger which can be modified.
Constant Summary collapse
- @@logger =
nil
- @@logger_output =
nil
Class Method Summary collapse
-
.included(base) ⇒ Object
Make the logger available both on a class and instance level once included.
Instance Method Summary collapse
-
#logger ⇒ Logger
Accesses the logger.
-
#logger_output=(value) ⇒ Object
Sets up the output stream for the logger.
Class Method Details
.included(base) ⇒ Object
Make the logger available both on a class and instance level once included.
13 14 15 |
# File 'lib/virtualbox/ext/logger.rb', line 13 def self.included(base) base.extend self end |
Instance Method Details
#logger ⇒ Logger
Accesses the logger. If logger output is specified and this is the first load, then the logger will be properly setup to point to that output. Logging levels should also be set once the logger is created. The logger is a standard Ruby ‘Logger`.
The VirtualBox gem can get very verybose very quickly, so choose a log level which suits the granularity needed.
34 35 36 |
# File 'lib/virtualbox/ext/logger.rb', line 34 def logger @@logger ||= ::Logger.new(@@logger_output) end |
#logger_output=(value) ⇒ Object
Sets up the output stream for the logger. This should be called before any calls to #logger. If the logger has already been instantiated, then a new logger will be created on the next call with the new output setup.
20 21 22 23 |
# File 'lib/virtualbox/ext/logger.rb', line 20 def logger_output=(value) @@logger_output = value @@logger = nil end |