Class: EZMQ::Logger

Inherits:
Object
  • Object
show all
Defined in:
lib/robot_sweatshop/connections.rb

Instance Method Summary collapse

Constructor Details

#initialize(process) ⇒ Logger

Returns a new instance of Logger.



25
26
27
28
29
30
31
# File 'lib/robot_sweatshop/connections.rb', line 25

def initialize(process)
  @process = process
  @logger = EZMQ::Publisher.new :connect, port: configatron.logger_port
  @logger.serialize_with_json!
  @user = `whoami`.chomp
  @host = `hostname`.chomp
end

Instance Method Details

#write(text) ⇒ Object



33
34
35
36
37
38
39
40
41
42
# File 'lib/robot_sweatshop/connections.rb', line 33

def write(text)
  data = {
    text: text,
    process: @process,
    user: @user,
    host: @host
  }
  @logger.send data, topic: 'robot-sweatshop-logging'
  nil
end