Class: Log4r::RemoteSyslogOutputter
- Inherits:
-
Outputter
- Object
- Outputter
- Log4r::RemoteSyslogOutputter
- Defined in:
- lib/log4r_remote_syslog_outputter/log4r/outputter/remote_syslog_outputter.rb
Instance Method Summary collapse
-
#initialize(name, options = {}) ⇒ RemoteSyslogOutputter
constructor
The url is required here but it has to be specified as an option (not a parameter) because that’s the only way it can be created from a configuration file.
Constructor Details
#initialize(name, options = {}) ⇒ RemoteSyslogOutputter
The url is required here but it has to be specified as an option (not a parameter) because that’s the only way it can be created from a configuration file.
:url is given when an XML configuration file is used
'url' is given when a YAML configuration file is used
12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/log4r_remote_syslog_outputter/log4r/outputter/remote_syslog_outputter.rb', line 12 def initialize(name, = {}) url = ['url'] url ||= [:url] uri = URI.parse(url) .dup.tap do |o| super(name, [:level, :formatter, :url, 'url'].inject({}) { |h, i| h.tap { |a| a[i] = o.delete(i) } }) @udp_sender = RemoteSyslogLogger::UdpSender.new(uri.host, uri.port, symbolize_keys(o)) end end |