7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/shared/logger_helper.rb', line 7
def logfile config, pipe
return nil unless config.is_a?(Hash)
logfile = File.expand_path(config[pipe].to_s, config[CONFIG_PATH].to_s)
if File.exists?(logfile)
unless File.writable?(logfile)
puts "LoggerHelper [#{pipe}] disabled: file not writable [#{logfile}]"
return nil
end
else
logdir = File.dirname(logfile)
unless File.writable?(logdir)
puts "LoggerHelper [#{pipe}] disabled: directory not writable [#{logdir}]"
return nil
end
end
puts "LoggerHelper [#{pipe}] logging to [#{logfile}]"
return logfile
end
|