Sha256: 14818351b1c9ad2d750a58705abfa8811d07509b04c53e854d6470ab098629d4

Contents?: true

Size: 523 Bytes

Versions: 1

Compression:

Stored size: 523 Bytes

Contents

require 'after_do'
require 'logger'

module Kamerling module Logging
  module_function

  def log_to logger: Logger.new($stdout)
    Server::Sock.extend AfterDo
    Server::Sock.before :start do |*, server|
      logger.info "start #{server.addr}"
    end
    Server::Sock.before :handle do |input, client_addr|
      logger.info "connect #{client_addr}"
      logger.debug "received #{client_addr} #{input}"
    end
    Server::Sock.after :stop do |*, server|
      logger.info "stop #{server.addr}"
    end
  end
end end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
kamerling-0.0.1 lib/kamerling/logging.rb