### Home Classes Methods

### In Files

- lib/phusion_passenger/debug_logging.rb

### Methods

- ::_log_device
- ::debug
- ::error
- ::included
- ::log_file=
- ::log_level
- ::log_level=
- ::stderr_evaluator=
- ::trace
- ::warn

### Class/Module Index

Quicksearch

- PhusionPassenger
- PhusionPassenger::AbstractInstaller
- PhusionPassenger::AbstractInstaller::Abort
- PhusionPassenger::AbstractInstaller::CommandError
- PhusionPassenger::AdminTools
- PhusionPassenger::AdminTools::MemoryStats
- PhusionPassenger::AdminTools::MemoryStats::Process
- PhusionPassenger::AdminTools::ServerInstance
- PhusionPassenger::AdminTools::ServerInstance::CorruptedDirectoryError
- PhusionPassenger::AdminTools::ServerInstance::GenerationsAbsentError
- PhusionPassenger::AdminTools::ServerInstance::Group
- PhusionPassenger::AdminTools::ServerInstance::Process
- PhusionPassenger::AdminTools::ServerInstance::RoleDeniedError
- PhusionPassenger::AdminTools::ServerInstance::StaleDirectoryError
- PhusionPassenger::AdminTools::ServerInstance::Stats
- PhusionPassenger::AdminTools::ServerInstance::UnsupportedGenerationStructureVersionError
- PhusionPassenger::AnalyticsLogger
- PhusionPassenger::AnalyticsLogger::Connection
- PhusionPassenger::AnalyticsLogger::Lock
- PhusionPassenger::AnalyticsLogger::Log
- PhusionPassenger::ClassicRails
- PhusionPassenger::ClassicRails::CGIFixed
- PhusionPassenger::ClassicRails::ThreadHandlerExtension
- PhusionPassenger::ConsoleTextTemplate
- PhusionPassenger::DebugLogging
- PhusionPassenger::LoaderSharedHelpers
- PhusionPassenger::MessageChannel
- PhusionPassenger::MessageChannel::InvalidHashError
- PhusionPassenger::MessageClient
- PhusionPassenger::NativeSupportLoader
- PhusionPassenger::Packaging
- PhusionPassenger::PlatformInfo
- PhusionPassenger::PlatformInfo::ApacheDetector
- PhusionPassenger::PlatformInfo::ApacheDetector::Result
- PhusionPassenger::PlatformInfo::Depcheck
- PhusionPassenger::PlatformInfo::Depcheck::ConsoleRunner
- PhusionPassenger::PlatformInfo::Depcheck::Dependency
- PhusionPassenger::PlatformInfo::RuntimeError
- PhusionPassenger::Plugin
- PhusionPassenger::PreloaderSharedHelpers
- PhusionPassenger::Rack
- PhusionPassenger::Rack::OutOfBandGc
- PhusionPassenger::Rack::ThreadHandlerExtension
- PhusionPassenger::Rails3Extensions
- PhusionPassenger::Rails3Extensions::AnalyticsLogging
- PhusionPassenger::Rails3Extensions::AnalyticsLogging::ACExtension
- PhusionPassenger::Rails3Extensions::AnalyticsLogging::ASBenchmarkableExtension
- PhusionPassenger::Rails3Extensions::AnalyticsLogging::ExceptionLogger
- PhusionPassenger::RequestHandler
- PhusionPassenger::RequestHandler::ThreadHandler
- PhusionPassenger::RequestHandler::ThreadHandler::Interrupted
- PhusionPassenger::SharedConstants
- PhusionPassenger::Standalone
- PhusionPassenger::Standalone::AppFinder
- PhusionPassenger::Standalone::Command
- PhusionPassenger::Standalone::ConfigFile
- PhusionPassenger::Standalone::ConfigFile::DisallowedContextError
- PhusionPassenger::Standalone::HelpCommand
- PhusionPassenger::Standalone::Main
- PhusionPassenger::Standalone::PackageRuntimeCommand
- PhusionPassenger::Standalone::RuntimeInstaller
- PhusionPassenger::Standalone::RuntimeLocator
- PhusionPassenger::Standalone::StartCommand
- PhusionPassenger::Standalone::StatusCommand
- PhusionPassenger::Standalone::StopCommand
- PhusionPassenger::Standalone::Utils
- PhusionPassenger::Standalone::VersionCommand
- PhusionPassenger::Utils
- PhusionPassenger::Utils::AnsiColors
- PhusionPassenger::Utils::FileSystemWatcher
- PhusionPassenger::Utils::FileSystemWatcher::DirInfo
- PhusionPassenger::Utils::FileSystemWatcher::FileInfo
- PhusionPassenger::Utils::GeneratorTest
- PhusionPassenger::Utils::HostsFileParser
- PhusionPassenger::Utils::JSON
- PhusionPassenger::Utils::JSON::Generator
- PhusionPassenger::Utils::ParserTest
- PhusionPassenger::Utils::TeeInput
- PhusionPassenger::Utils::TmpIO
- PhusionPassenger::Utils::UnseekableSocket
- CommonLibraryBuilder
- Exception
- GC
- IO
- Object
- Signal

No matching classes.

# PhusionPassenger::DebugLogging

### Public Class Methods

_log_device() click to toggle source

    # File lib/phusion_passenger/debug_logging.rb, line 59
    def self._log_device
            return @@log_device
    end

debug(message) click to toggle source

    # File lib/phusion_passenger/debug_logging.rb, line 81
    def debug(message)
            trace(1, message, 1)
    end

error(message) click to toggle source

    # File lib/phusion_passenger/debug_logging.rb, line 71
    def error(message)
            trace(-1, message, 1)
    end

included(klass) click to toggle source

    # File lib/phusion_passenger/debug_logging.rb, line 34
    def self.included(klass)
            klass.class_eval do
                    private :debug
                    private :trace
            end
    end

log_file=(filename) click to toggle source

    # File lib/phusion_passenger/debug_logging.rb, line 49
    def self.log_file=(filename)
            if filename && filename.empty?
                    @@log_filename = nil
            else
                    @@log_filename = filename
            end
            @@log_device.close if @@log_device && !@@log_device.closed?
            @@log_device = nil
    end

log_level() click to toggle source

    # File lib/phusion_passenger/debug_logging.rb, line 41
    def self.log_level
            return @@log_level
    end

log_level=(level) click to toggle source

    # File lib/phusion_passenger/debug_logging.rb, line 45
    def self.log_level=(level)
            @@log_level = level
    end

stderr_evaluator=(block) click to toggle source

    # File lib/phusion_passenger/debug_logging.rb, line 63
    def self.stderr_evaluator=(block)
            if block
                    @@stderr_evaluator = block
            else
                    @@stderr_evaluator = lambda { STDERR }
            end
    end

trace(level, message, nesting_level = 0) click to toggle source

    # File lib/phusion_passenger/debug_logging.rb, line 86
    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("%04d", now.usec / 100)

                    current_thread = Thread.current
                    if !(thread_id = current_thread[:id])
                            current_thread.to_s =~ /:(0x[0-9a-f]+)/
                            thread_id = current_thread[:id] = $1 || '?'
                    end
                    if thread_name = current_thread[:name]
                            thread_name = "(#{thread_name})"
                    end

                    output.write("[ #{time_str} #{$$}/#{thread_id}#{thread_name} #{location} ]: #{message}\n")
                    output.flush
            end
    end

warn(message) click to toggle source

    # File lib/phusion_passenger/debug_logging.rb, line 76
    def warn(message)
            trace(0, message, 1)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.