Class: Sapience::Subscriber

Inherits:
Base
  • Object
show all
Extended by:
Descendants
Defined in:
lib/sapience/subscriber.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#filter

Instance Method Summary collapse

Methods included from Descendants

descendants

Methods inherited from Base

#fast_tag, #level=, #measure, #payload, #pop_tags, #push_tags, #silence, #tagged, #tags, #with_payload

Instance Attribute Details

#applicationObject

Allow application name to be set globally or per subscriber



37
38
39
# File 'lib/sapience/subscriber.rb', line 37

def application
  @application || Sapience.config.application
end

#formatterObject

Every logger has its own formatter



7
8
9
# File 'lib/sapience/subscriber.rb', line 7

def formatter
  @formatter
end

#hostObject

Allow host name to be set globally or per subscriber



42
43
44
# File 'lib/sapience/subscriber.rb', line 42

def host
  @host || Sapience.config.host
end

Instance Method Details

#closeObject

A subscriber should implement close if it can.



27
28
29
# File 'lib/sapience/subscriber.rb', line 27

def close
  # NOOP
end

#default_formatterObject

Returns [Sapience::Formatters::Default] formatter default for this subscriber



32
33
34
# File 'lib/sapience/subscriber.rb', line 32

def default_formatter
  Sapience::Formatters::Default.new
end

#flushObject

A subscriber should implement flush if it can.



18
19
20
# File 'lib/sapience/subscriber.rb', line 18

def flush
  # NOOP
end

#levelObject

Returns the current log level if set, otherwise it logs everything it receives



13
14
15
# File 'lib/sapience/subscriber.rb', line 13

def level
  @level || :trace
end

#nameObject



22
23
24
# File 'lib/sapience/subscriber.rb', line 22

def name
  self.class.name
end