Class: Logdash::Client

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key: nil, host: 'https://api.logdash.io', verbose: false) ⇒ Client

Returns a new instance of Client.



11
12
13
14
15
16
17
18
19
20
# File 'lib/logdash/client.rb', line 11

def initialize(api_key: nil, host: 'https://api.logdash.io', verbose: false)
  @api_key = api_key
  @host = host
  @verbose = verbose

  log_sync_instance = create_log_sync(api_key, host, verbose)
  @logger = Logger.new(log_sync: log_sync_instance)

  @metrics = create_metrics(api_key, host, verbose)
end

Instance Attribute Details

#loggerObject (readonly)

Returns the value of attribute logger.



9
10
11
# File 'lib/logdash/client.rb', line 9

def logger
  @logger
end

#metricsObject (readonly)

Returns the value of attribute metrics.



9
10
11
# File 'lib/logdash/client.rb', line 9

def metrics
  @metrics
end

Class Method Details

.create(api_key: nil, host: 'https://api.logdash.io', verbose: false) ⇒ Object



22
23
24
25
# File 'lib/logdash/client.rb', line 22

def self.create(api_key: nil, host: 'https://api.logdash.io', verbose: false)
  client = new(api_key: api_key, host: host, verbose: verbose)
  { logger: client.logger, metrics: client.metrics }
end