class SPSPubLogDRbClient

Constants

DEBUG
ERROR
FATAL
INFO
UNKNOWN
WARN

Attributes

level[RW]

Public Class Methods

new(host: '127.0.0.1', port: '9090', level: Severity::DEBUG) click to toggle source
# File lib/spspublog_drb_client.rb, line 37
def initialize(host: '127.0.0.1', port: '9090', level: Severity::DEBUG)

  DRb.start_service
  
  @log = DRbObject.new nil, "druby://#{host}:#{port}"
  @log.level = level

end

Public Instance Methods

debug(s) click to toggle source
# File lib/spspublog_drb_client.rb, line 46
def debug(s)
  @log.debug s
end
error(s) click to toggle source
# File lib/spspublog_drb_client.rb, line 50
def error(s)
  @log.error s
end
fatal(s) click to toggle source
# File lib/spspublog_drb_client.rb, line 54
def fatal(s)
  @log.fatal s
end
info(s) click to toggle source
# File lib/spspublog_drb_client.rb, line 58
def info(s)
  @log.info s
end
level=(val) click to toggle source
# File lib/spspublog_drb_client.rb, line 66
def level=(val)
  @log.level = set_level val
end

Private Instance Methods

set_level(level) click to toggle source
# File lib/spspublog_drb_client.rb, line 72
def set_level(level)
  
  if level.is_a? Symbol then
    %i(debug info warn error fatal unknown).zip(0..5).to_h[level]
  else
    level
  end    
  
end