class CustomLogs::Socket
Public Class Methods
get()
click to toggle source
# File lib/custom_logs/socket.rb, line 10 def get @@socket if @@socket if (syslog_config = ParseConfig.get[:syslog]).present? @@socket = RemoteSyslogLogger.new(syslog_config[:host], syslog_config[:port]) @@socket_type = :syslog else @@socket = ::Logger.new(STDOUT) @@socket_type = :stdout end @@socket.formatter = proc do |severity, datetime, progname, msg| "#{msg}\n" end @@socket end
socket_type()
click to toggle source
# File lib/custom_logs/socket.rb, line 31 def socket_type get unless @@socket @@socket_type end
stdout?()
click to toggle source
# File lib/custom_logs/socket.rb, line 40 def stdout? socket_type == :stdout end
syslog?()
click to toggle source
# File lib/custom_logs/socket.rb, line 36 def syslog? socket_type == :syslog end
write(message)
click to toggle source
# File lib/custom_logs/socket.rb, line 27 def write(message) get.unknown("[CUSTOM-LOGS]#{message}") end