Class: Adalog::SimpleLoggingAdapter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service_name, repo) ⇒ SimpleLoggingAdapter

Returns a new instance of SimpleLoggingAdapter.



6
7
8
9
# File 'lib/adalog/simple_logging_adapter.rb', line 6

def initialize(service_name, repo)
  @service_name = service_name
  @repo         = 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?



13
14
15
16
17
18
# File 'lib/adalog/simple_logging_adapter.rb', line 13

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.



4
5
6
# File 'lib/adalog/simple_logging_adapter.rb', line 4

def repo
  @repo
end

#service_nameObject (readonly)

Returns the value of attribute service_name.



4
5
6
# File 'lib/adalog/simple_logging_adapter.rb', line 4

def service_name
  @service_name
end