class RTALogger::LogRepositoryUDP
show log items on console out put
Public Class Methods
new(host = '127.0.0.1', port = 4913)
click to toggle source
Calls superclass method
RTALogger::LogRepository::new
# File lib/log_repository_udp.rb, line 6 def initialize(host = '127.0.0.1', port = 4913) super() @udp_socket = UDPSocket.new @udp_socket.bind(host, port) end
Public Instance Methods
load_config(config_json)
click to toggle source
Calls superclass method
RTALogger::LogRepository#load_config
# File lib/log_repository_udp.rb, line 12 def load_config(config_json) super host = config_json['host'].to_s port = config_json['port'].nil? ? 4913 : config_json['port'].to_i @udp_socket = UDPSocket.new @udp_socket.bind(host, port) end
Protected Instance Methods
flush_and_clear()
click to toggle source
register :udp
Calls superclass method
RTALogger::LogRepository#flush_and_clear
# File lib/log_repository_udp.rb, line 25 def flush_and_clear semaphore.synchronize do @log_records.each { |log_record| @udp_socket.send @formatter.format(log_record), 0, @host, @port } end super end