Log

class
Superclass
Mongrel2::Config( :log )

Mongrel2 configuration Log class

Public Class Methods

anchor
log_action( what, why=nil, where=nil, how=nil )

Log an entry to the commit log with the given what, why, where, and how values and return it after it's saved.

# File lib/mongrel2/config/log.rb, line 23
def self::log_action( what, why=nil, where=nil, how=nil )
        where ||= Socket.gethostname
        how ||= File.basename( $0 )

        who = Etc.getlogin

        return self.create(
                who:      who,
                what:     what,
                location: where,
                how:      how,
                why:      why
        )
end

Public Instance Methods

anchor
happened_at()

Get the timestamp of the event.

# File lib/mongrel2/config/log.rb, line 61
        
anchor
how()

Get a description of “how” the event happened.

# File lib/mongrel2/config/log.rb, line 65
        
anchor
id()

Get the ID of the log entry

# File lib/mongrel2/config/log.rb, line 45
        
anchor
location()

Get the “where” of the event.

# File lib/mongrel2/config/log.rb, line 57
        
anchor
to_s()

Stringify the log entry and return it.

# File lib/mongrel2/config/log.rb, line 72
def to_s
        # 2011-09-09 19:35:40 [who] @where how: what (why)
        msg = "%{happened_at} [%{who}] @%{location} %{how}: %{what}" % self.values
        msg += " (#{self.why})" if self.why
        return msg
end
anchor
what()

Get a description of “what” happened

# File lib/mongrel2/config/log.rb, line 53
        
anchor
who()

Get “who” was reponsible for the event.

# File lib/mongrel2/config/log.rb, line 49
        
anchor
why()

Get a description of “why” the event happened.

# File lib/mongrel2/config/log.rb, line 71