Class: Protobuf::Logger
- Inherits:
-
Logger
- Object
- Logger
- Protobuf::Logger
- Defined in:
- lib/protobuf/logger.rb
Defined Under Namespace
Modules: LogMethods
Class Attribute Summary collapse
-
.file ⇒ Object
Returns the value of attribute file.
-
.level ⇒ Object
Returns the value of attribute level.
Class Method Summary collapse
-
.configure(options) ⇒ Object
One-line file/level/logger configuration.
-
.instance ⇒ Object
Singleton instance.
-
.reset_device! ⇒ Object
Use to reset the instance.
Class Attribute Details
.file ⇒ Object
Returns the value of attribute file.
7 8 9 |
# File 'lib/protobuf/logger.rb', line 7 def file @file end |
.level ⇒ Object
Returns the value of attribute level.
7 8 9 |
# File 'lib/protobuf/logger.rb', line 7 def level @level end |
Class Method Details
.configure(options) ⇒ Object
One-line file/level/logger configuration. If logger is specified, file and level are ignored.
24 25 26 27 28 |
# File 'lib/protobuf/logger.rb', line 24 def self.configure() @__instance = .fetch(:logger, nil) self.file = .fetch(:file, false) self.level = .fetch(:level, false) end |
.instance ⇒ Object
Singleton instance
36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/protobuf/logger.rb', line 36 def self.instance @__instance ||= begin log = nil if @file && @level log = new(self.file) log.level = self.level end log end end |
.reset_device! ⇒ Object
Use to reset the instance
31 32 33 |
# File 'lib/protobuf/logger.rb', line 31 def self.reset_device! self.file = self.level = @__instance = nil end |