class EZMQ::Logger

Public Class Methods

new(process) click to toggle source
# 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

Public Instance Methods

write(text) click to toggle source
# 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