Module: RSMP::Logging

Included in:
Collector, Node, Proxy
Defined in:
lib/rsmp/log/logging.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#archiveObject (readonly)

Returns the value of attribute archive.



7
8
9
# File 'lib/rsmp/log/logging.rb', line 7

def archive
  @archive
end

#loggerObject (readonly)

Returns the value of attribute logger.



7
8
9
# File 'lib/rsmp/log/logging.rb', line 7

def logger
  @logger
end

Instance Method Details

#authorObject



14
# File 'lib/rsmp/log/logging.rb', line 14

def author; end

#initialize_logging(options) ⇒ Object



9
10
11
12
# File 'lib/rsmp/log/logging.rb', line 9

def initialize_logging(options)
  @archive = options[:archive] || RSMP::Archive.new
  @logger = options[:logger] || RSMP::Logger.new(options[:log_settings])
end

#log(str, options = {}) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/rsmp/log/logging.rb', line 16

def log(str, options = {})
  default = { text: str, level: :log, author: author, ip: @ip, port: @port }
  prepared = RSMP::Archive.prepare_item default.merge(options)
  @archive.add prepared
  @logger.log prepared
  prepared
end