summaryrefslogtreecommitdiff
path: root/lib/oxidized/log.rb
diff options
context:
space:
mode:
authorSaku Ytti <saku@ytti.fi>2014-02-27 13:39:04 +0200
committerSaku Ytti <saku@ytti.fi>2014-02-27 13:39:04 +0200
commit044477406fafcc8ad5b371027665a675e95a6210 (patch)
treeafec336787a319f1257f72f35955c43e5517727b /lib/oxidized/log.rb
parent49ac63e8609d265986506fc5589b3fed83bc71a4 (diff)
Switch to syslog instead of file
1.9.3 does not have Syslog::Logger so in 1.9.3 keep on logging to files
Diffstat (limited to 'lib/oxidized/log.rb')
-rw-r--r--lib/oxidized/log.rb26
1 files changed, 17 insertions, 9 deletions
diff --git a/lib/oxidized/log.rb b/lib/oxidized/log.rb
index db39462..9e77646 100644
--- a/lib/oxidized/log.rb
+++ b/lib/oxidized/log.rb
@@ -1,13 +1,21 @@
module Oxidized
- require 'logger'
- class Logger < Logger
- def initialize target=STDOUT
- super target
- self.level = Logger::DEBUG
- end
- def file= target
- @logdev = LogDevice.new target
+
+ begin
+ require 'syslog/logger'
+ Log = Syslog::Logger.new 'oxidized'
+ Log.define_singleton_method(:file=){|arg|}
+ rescue LoadError
+ # 1.9.3 has no love for syslog
+ require 'logger'
+ class Logger < Logger
+ def initialize target=STDOUT
+ super target
+ end
+ def file= target
+ @logdev = LogDevice.new target
+ end
end
+ Log = Logger.new
end
- Log = Logger.new
+
end