summaryrefslogtreecommitdiff
path: root/lib/oxidized/log.rb
blob: e9ae1b4542d86a63860391917675b83ada4f237c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module Oxidized

  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
       FileUtils.mkdir_p File.dirname(target)
       @logdev = LogDevice.new target
     end
    end
    Log = Logger.new
  end

end