Class: Lumberjack::Client
- Inherits:
-
Object
- Object
- Lumberjack::Client
- Defined in:
- lib/lumberjack/client.rb
Instance Method Summary collapse
- #host ⇒ Object
-
#initialize(opts = {}) ⇒ Client
constructor
A new instance of Client.
- #write(hash) ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Client
Returns a new instance of Client.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/lumberjack/client.rb', line 11 def initialize(opts={}) @opts = { :port => 0, :addresses => [], :ssl_certificate => nil, :window_size => 5000 }.merge(opts) @opts[:addresses] = [@opts[:addresses]] if @opts[:addresses].class == String raise "Must set a port." if @opts[:port] == 0 raise "Must set atleast one address" if @opts[:addresses].empty? == 0 raise "Must set a ssl certificate or path" if @opts[:ssl_certificate].nil? @socket = connect end |
Instance Method Details
#host ⇒ Object
47 48 49 |
# File 'lib/lumberjack/client.rb', line 47 def host @socket.host end |
#write(hash) ⇒ Object
42 43 44 |
# File 'lib/lumberjack/client.rb', line 42 def write(hash) @socket.write_hash(hash) end |