# File lib/phusion_passenger/debug_logging.rb, line 82
        def trace(level, message, nesting_level = 0)
                if @@log_level >= level
                        if @@log_filename
                                if !@@log_device || @@log_device.closed?
                                        @@log_device = File.open(@@log_filename, "a")
                                end
                                output = @@log_device
                        else
                                output = @@stderr_evaluator.call
                        end
                        location = caller[nesting_level].sub(/.*phusion_passenger\//, '')
                        location.sub!(/(.*):.*/, '\1')
                        now = Time.now
                        time_str = now.strftime("%Y-%m-%d %H:%M:%S.")
                        time_str << sprintf("%03d", now.usec / 1000)
                        output.write("[ pid=#{$$} thr=#{Thread.current.object_id} file=#{location} time=#{time_str} ]: #{message}\n")
                        output.flush
                end
        end