Class: Logput::Adapters::Base
- Inherits:
-
Object
- Object
- Logput::Adapters::Base
- Defined in:
- lib/logput/adapters/base.rb
Overview
Base class from which all adapters inherit
Direct Known Subclasses
Class Method Summary collapse
-
.handles?(_logger) ⇒ Boolean
Placeholder for handles? method to be overridden when subclassed.
-
.register(adapter) ⇒ Object
Registers a new adapter.
Instance Method Summary collapse
-
#initialize(logger) ⇒ Base
constructor
Initialize.
-
#path ⇒ String
Placeholder for path method to be overridden when subclassed.
-
#path_override ⇒ String
Enable overriding of the path with an environment variable.
Constructor Details
#initialize(logger) ⇒ Base
Initialize
8 9 10 |
# File 'lib/logput/adapters/base.rb', line 8 def initialize(logger) @logger = logger end |
Class Method Details
.handles?(_logger) ⇒ Boolean
Placeholder for handles? method to be overridden when subclassed
23 24 25 |
# File 'lib/logput/adapters/base.rb', line 23 def self.handles?(_logger) raise NotImplementedError end |
.register(adapter) ⇒ Object
Registers a new adapter
15 16 17 18 |
# File 'lib/logput/adapters/base.rb', line 15 def self.register(adapter) raise "Already Registered :#{adapter}" if Logput::Adapters.registered_adapters[adapter] Logput::Adapters.registered_adapters[adapter] = self end |
Instance Method Details
#path ⇒ String
Placeholder for path method to be overridden when subclassed
29 30 31 |
# File 'lib/logput/adapters/base.rb', line 29 def path raise NotImplementedError end |
#path_override ⇒ String
Enable overriding of the path with an environment variable
35 36 37 38 39 |
# File 'lib/logput/adapters/base.rb', line 35 def path_override return unless directory && filename "#{directory}/#{filename}.log" end |