Class: Palmade::Tapsilog::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/palmade/tapsilog/client.rb

Direct Known Subclasses

Logger

Constant Summary collapse

DEFAULT_OPTIONS =
{
  :async => false
}

Instance Method Summary collapse

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, options = { })
  @service = service.to_s
  @instance_key = instance_key

  @target = target
  @key = key

  @options = DEFAULT_OPTIONS.merge(options)
  @conn = Palmade::Tapsilog::Conn.new(@target, @key, @options[:async])
end

Instance Method Details

#closeObject



29
30
31
# File 'lib/palmade/tapsilog/client.rb', line 29

def close
  @conn.close
end

#closed?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/palmade/tapsilog/client.rb', line 33

def closed?
  @conn.closed?
end

#flushObject



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, tags = {}, ts = nil)
  ts = Time.now if ts.nil?
  conn_log(severity, msg, tags, ts)
  self
end

#reconnectObject



37
38
39
# File 'lib/palmade/tapsilog/client.rb', line 37

def reconnect
  @conn.reconnect!
end