Class: HumbleRPiPluginLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/humble_rpi-plugin-logger.rb

Instance Method Summary collapse

Constructor Details

#initialize(settings: {}, variables: {}) ⇒ HumbleRPiPluginLogger

Returns a new instance of HumbleRPiPluginLogger.



10
11
12
13
14
# File 'lib/humble_rpi-plugin-logger.rb', line 10

def initialize(settings: {}, variables: {})
  
  @log = Logger.new(settings[:filepath] || 'hrpi.log')
  
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *args) ⇒ Object



16
17
18
# File 'lib/humble_rpi-plugin-logger.rb', line 16

def method_missing(method_name, *args)
  @log.info "method %s invoked; args: %s" % [method_name, args]
end

Instance Method Details

#on_exitObject



32
33
34
# File 'lib/humble_rpi-plugin-logger.rb', line 32

def on_exit()
  @log.info 'on_exit() invoked'
end

#respond_to?(name) ⇒ Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/humble_rpi-plugin-logger.rb', line 20

def respond_to?(name)
  true
end

#startObject Also known as: on_start



24
25
26
27
28
# File 'lib/humble_rpi-plugin-logger.rb', line 24

def start()

  @log.info 'on_start() invoked'
  
end