Class: Blabbermouth::Bystanders::Syslog

Inherits:
Base
  • Object
show all
Includes:
DynamicEvents, Formatter
Defined in:
lib/blabbermouth/syslog/bystander.rb

Constant Summary collapse

LOG_LEVELS =
[:debug, :error, :fatal, :info, :unknown, :warn]

Instance Method Summary collapse

Instance Method Details

#count(key, total, *args) ⇒ Object



41
42
43
# File 'lib/blabbermouth/syslog/bystander.rb', line 41

def count(key, total, *args)
  relay :count, key, total, *args
end

#debug(key, msg = nil, *args) ⇒ Object



11
12
13
# File 'lib/blabbermouth/syslog/bystander.rb', line 11

def debug(key, msg=nil, *args)
  relay :debug, key, msg, *args
end

#error(key, e, *args) ⇒ Object



15
16
17
# File 'lib/blabbermouth/syslog/bystander.rb', line 15

def error(key, e, *args)
  relay :error, key, e, *args
end

#fatal(key, e, *args) ⇒ Object Also known as: critical



19
20
21
# File 'lib/blabbermouth/syslog/bystander.rb', line 19

def fatal(key, e, *args)
  relay :fatal, key, e, *args
end

#increment(key, by = 1, *args) ⇒ Object



45
46
47
# File 'lib/blabbermouth/syslog/bystander.rb', line 45

def increment(key, by=1, *args)
  relay :increment, key, by, *args
end

#info(key, msg = nil, *args) ⇒ Object



24
25
26
# File 'lib/blabbermouth/syslog/bystander.rb', line 24

def info(key, msg=nil, *args)
  relay :info, key, msg, *args
end

#log_message(event, key, msg, data = {}) ⇒ Object



54
55
56
57
58
59
# File 'lib/blabbermouth/syslog/bystander.rb', line 54

def log_message(event, key, msg, data={})
  message = "Blabbermouth.#{event.to_s}: #{key.to_s}"
  message += ": #{msg.to_s}" unless msg.to_s.blank?
  message += " #{data.to_s}"
  message
end

#relay(meth, key, *args) ⇒ Object



49
50
51
52
# File 'lib/blabbermouth/syslog/bystander.rb', line 49

def relay(meth, key, *args)
  data, opts, args = parse_args(*args)
  log meth, key, args.first, data
end

#time(key, duration, *args) ⇒ Object



37
38
39
# File 'lib/blabbermouth/syslog/bystander.rb', line 37

def time(key, duration, *args)
  relay :time, key, duration, *args
end

#unknown(key, msg = nil, *args) ⇒ Object



28
29
30
# File 'lib/blabbermouth/syslog/bystander.rb', line 28

def unknown(key, msg=nil, *args)
  relay :unknown, key, msg, *args
end

#warn(key, msg = nil, *args) ⇒ Object Also known as: warning



32
33
34
# File 'lib/blabbermouth/syslog/bystander.rb', line 32

def warn(key, msg=nil, *args)
  relay :warn, key, msg, *args
end