Sha256: fdd8a01deee4c259be1ade543e9b661f49a9f438bbd256d734ca71f13fade523

Contents?: true

Size: 429 Bytes

Versions: 1

Compression:

Stored size: 429 Bytes

Contents

require 'ezmq'
class Logger

  def initialize options={}
    @port = options[:port]
    @topic = options[:topic]
    @transport = options[:transport]
    @delay = options [:delay]
    @logger = EZMQ::Publisher.new :connect, port: @port, transport: @transport
    sleep 1 if @delay
  end

  def log message
    @logger.send message, topic: @topic
  end

end

# delayed mode will sleep for 1 second after initializing the publisher

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
socketlogger-0.0.2 lib/socketlogger.rb