Class: Palmade::Tapsilog::Client
- Inherits:
-
Object
- Object
- Palmade::Tapsilog::Client
- Defined in:
- lib/palmade/tapsilog/client.rb
Direct Known Subclasses
Constant Summary collapse
- DEFAULT_OPTIONS =
{ :async => false }
Instance Method Summary collapse
- #close ⇒ Object
- #closed? ⇒ Boolean
- #flush ⇒ Object
-
#initialize(service = 'default', target = '127.0.0.1:19070', key = nil, instance_key = nil, options = { }) ⇒ Client
constructor
A new instance of Client.
- #log(severity, msg, tags = {}, ts = nil) ⇒ Object
- #reconnect ⇒ Object
Constructor Details
#initialize(service = 'default', target = '127.0.0.1:19070', key = nil, instance_key = nil, options = { }) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 13 14 15 16 17 |
# File 'lib/palmade/tapsilog/client.rb', line 8 def initialize(service = 'default', target = '127.0.0.1:19070', key = nil, instance_key = nil, = { }) @service = service.to_s @instance_key = instance_key @target = target @key = key @options = DEFAULT_OPTIONS.merge() @conn = Palmade::Tapsilog::Conn.new(@target, @key, @options[:async]) end |
Instance Method Details
#close ⇒ Object
29 30 31 |
# File 'lib/palmade/tapsilog/client.rb', line 29 def close @conn.close end |
#closed? ⇒ Boolean
33 34 35 |
# File 'lib/palmade/tapsilog/client.rb', line 33 def closed? @conn.closed? end |
#flush ⇒ Object
25 26 27 |
# File 'lib/palmade/tapsilog/client.rb', line 25 def flush @conn.flush end |
#log(severity, msg, tags = {}, ts = nil) ⇒ Object
19 20 21 22 23 |
# File 'lib/palmade/tapsilog/client.rb', line 19 def log(severity, msg, = {}, ts = nil) ts = Time.now if ts.nil? conn_log(severity, msg, , ts) self end |
#reconnect ⇒ Object
37 38 39 |
# File 'lib/palmade/tapsilog/client.rb', line 37 def reconnect @conn.reconnect! end |