Class: Gitchefsync::Log::SysLogger
- Inherits:
-
Object
- Object
- Gitchefsync::Log::SysLogger
- 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
- #debug(*args) ⇒ Object
- #error(*args) ⇒ Object
- #fatal(*args) ⇒ Object
- #info(*args) ⇒ Object
-
#initialize(name) ⇒ SysLogger
constructor
TODO: may define syslog open at this point.
- #log(level, msg) ⇒ Object
- #warn(*args) ⇒ Object
Constructor Details
#initialize(name) ⇒ SysLogger
TODO: may define syslog open at this point
24 25 26 27 28 29 30 31 |
# File 'lib/gitchefsync/log.rb', line 24 def initialize(name) begin Syslog.open(name, Syslog::LOG_PID, Syslog::LOG_LOCAL1) rescue Exception => e puts "Syslog error: #{e.}" end end |
Instance Method Details
#debug(*args) ⇒ Object
33 34 35 |
# File 'lib/gitchefsync/log.rb', line 33 def debug(*args) log(Syslog::LOG_DEBUG,args[0]) end |
#error(*args) ⇒ Object
45 46 47 |
# File 'lib/gitchefsync/log.rb', line 45 def error(*args) log(Syslog::LOG_ERR,args[0]) end |
#fatal(*args) ⇒ Object
49 50 51 |
# File 'lib/gitchefsync/log.rb', line 49 def fatal(*args) log(Syslog::LOG_EMERG,args[0]) end |
#info(*args) ⇒ Object
37 38 39 |
# File 'lib/gitchefsync/log.rb', line 37 def info(*args) log(Syslog::LOG_INFO,args[0]) end |
#log(level, msg) ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/gitchefsync/log.rb', line 53 def log ( level, msg) begin Syslog.log(level, msg) ensure #Syslog.close end end |
#warn(*args) ⇒ Object
41 42 43 |
# File 'lib/gitchefsync/log.rb', line 41 def warn(*args) log(Syslog::LOG_WARNING,args[0]) end |