Module: Sysloggly
- Defined in:
- lib/sysloggly.rb,
lib/sysloggly/rails.rb,
lib/sysloggly/version.rb,
lib/sysloggly/clients/filelog.rb,
lib/sysloggly/clients/networklog.rb,
lib/sysloggly/extensions/honeybadger.rb,
lib/sysloggly/formatters/simple_formatter.rb,
lib/sysloggly/formatters/syslog_formatter.rb
Overview
Sysloggly default configuration for Rails
Defined Under Namespace
Modules: Clients, Extensions, Formatters Classes: InputURLRequired, Railtie, UnknownFacility, UnsupportedScheme
Constant Summary collapse
- VERSION =
"0.3.2".freeze
Class Method Summary collapse
- .configure {|_self| ... } ⇒ Object
-
.new(url, opts = {}) ⇒ Logger
Creates a new logger instance.
Class Method Details
.configure {|_self| ... } ⇒ Object
24 25 26 |
# File 'lib/sysloggly.rb', line 24 def self.configure yield self end |
.new(url, opts = {}) ⇒ Logger
Creates a new logger instance
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/sysloggly.rb', line 33 def self.new(url, opts = {}) raise InputURLRequired.new unless url begin input_uri = URI.parse(url) rescue URI::InvalidURIError => e raise InputURLRequired.new("Invalid Input URL: #{url}") end client, formatter = nil case input_uri.scheme when "file" client = Sysloggly::Clients::Filelog.new(input_uri.path) formatter = Sysloggly::Formatters::SimpleFormatter.new(input_uri, opts) when "udp", "tcp" client = Sysloggly::Clients::Networklog.new(input_uri) formatter = Sysloggly::Formatters::SyslogFormatter.new(input_uri, opts) else raise Sysloggly::UnsupportedScheme.new("#{input_uri.scheme} is unsupported") end logger = Logger.new(client) logger.formatter = formatter logger end |