Class: Gitchefsync::Log::SysLogger

Inherits:
Object
  • Object
show all
Defined in:
lib/gitchefsync/log.rb

Overview

Wrapped sys log Logger Overload all the logger methods - although substitution is not covered

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ SysLogger

TODO: may define syslog open at this point



8
9
10
11
12
13
14
15
# File 'lib/gitchefsync/log.rb', line 8

def initialize(name)
  begin
    Syslog.open(name, Syslog::LOG_PID, Syslog::LOG_LOCAL1)
  rescue Exception => e
    puts "Syslog error: #{e.message}"
  end

end

Instance Method Details

#debug(*args) ⇒ Object



17
18
19
# File 'lib/gitchefsync/log.rb', line 17

def debug(*args)
  log(Syslog::LOG_DEBUG,args[0])
end

#error(*args) ⇒ Object



29
30
31
# File 'lib/gitchefsync/log.rb', line 29

def error(*args)
  log(Syslog::LOG_ERR,args[0])
end

#fatal(*args) ⇒ Object



33
34
35
# File 'lib/gitchefsync/log.rb', line 33

def fatal(*args)
  log(Syslog::LOG_EMERG,args[0])
end

#info(*args) ⇒ Object



21
22
23
# File 'lib/gitchefsync/log.rb', line 21

def info(*args)
  log(Syslog::LOG_INFO,args[0])
end

#log(level, msg) ⇒ Object



37
38
39
40
41
42
43
# File 'lib/gitchefsync/log.rb', line 37

def log ( level, msg)
  begin
    Syslog.log(level, msg)
  ensure
    #Syslog.close
  end
end

#warn(*args) ⇒ Object



25
26
27
# File 'lib/gitchefsync/log.rb', line 25

def warn(*args)
  log(Syslog::LOG_WARNING,args[0])
end