Class: EZMQ::Logger
- Inherits:
-
Object
- Object
- EZMQ::Logger
- Defined in:
- lib/robot_sweatshop/connections.rb
Instance Method Summary collapse
-
#initialize(process) ⇒ Logger
constructor
A new instance of Logger.
- #write(text) ⇒ Object
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 |