Module: Logglier::Client
- Defined in:
- lib/logglier/client.rb,
lib/logglier/client/http.rb,
lib/logglier/client/syslog.rb,
lib/logglier/client/http/sync.rb,
lib/logglier/client/http/threaded.rb
Defined Under Namespace
Modules: InstanceMethods Classes: HTTP, Syslog
Class Method Summary collapse
-
.new(input_url, opts = {}) ⇒ Logglier::Client::HTTP, Logglier::Client::Syslog
Creates a new loggly client, based on a url scheme and options provided If a url string is passed, it becomes => <string>.
Class Method Details
.new(input_url, opts = {}) ⇒ Logglier::Client::HTTP, Logglier::Client::Syslog
Creates a new loggly client, based on a url scheme and options provided If a url string is passed, it becomes => <string>
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/logglier/client.rb', line 15 def self.new(input_url, opts={}) unless input_url raise InputURLRequired.new end opts.merge!({ :input_url => input_url }) begin input_uri = URI.parse(opts[:input_url]) rescue URI::InvalidURIError => e raise InputURLRequired.new("Invalid Input URL: #{input_uri}") end case input_uri.scheme when 'http', 'https' Logglier::Client::HTTP.new(opts) when 'udp', 'tcp' Logglier::Client::Syslog.new(opts) else raise Logglier::UnsupportedScheme.new("#{input_uri.scheme} is unsupported") end end |