![](http://www.gnu-darwin.org/hexley-gd-sm.png)
|
# File lib/rfilter/delivery_agent.rb, line 198
def log(level, str)
if level <= 0 and @logfile.nil?
raise LoggingError, "failed to log high priority message: #{str}"
end
return if @logfile.nil? or level > @logging_level
begin
@logfile.flock(File::LOCK_EX)
@logfile.print(Time.now.strftime("%Y/%m/%d %H:%M:%S "))
@logfile.print(sprintf("%05d: ", Process.pid))
@logfile.puts(str)
@logfile.flush
@logfile.flock(File::LOCK_UN)
rescue
# FIXME: this isn't tested
raise LoggingError.new("failed to log message: #{str}", $!)
end
end
|