Class: Adalog::SimpleLoggingAdapter::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/adalog/simple_logging_adapter.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, **kwargs, &block) ⇒ Base

Returns a new instance of Base.



21
22
23
24
# File 'lib/adalog/simple_logging_adapter.rb', line 21

def initialize(*args, **kwargs, &block)
  @service_name = self.class.service_name
  @repo         = self.class.repo
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(msg, *args, &block) ⇒ Object

TODO: Record something w.r.t. whether or not a block is given?



28
29
30
31
32
33
# File 'lib/adalog/simple_logging_adapter.rb', line 28

def method_missing(msg, *args, &block)
  repo.insert(
    title:    service_name,
    message:  msg,
    details:  args)
end

Instance Attribute Details

#repoObject (readonly)

Returns the value of attribute repo.



19
20
21
# File 'lib/adalog/simple_logging_adapter.rb', line 19

def repo
  @repo
end

#service_nameObject (readonly)

Returns the value of attribute service_name.



19
20
21
# File 'lib/adalog/simple_logging_adapter.rb', line 19

def service_name
  @service_name
end

Class Method Details

.repoObject



16
# File 'lib/adalog/simple_logging_adapter.rb', line 16

def repo        ; @repo         ; end

.service_nameObject



15
# File 'lib/adalog/simple_logging_adapter.rb', line 15

def service_name; @service_name ; end