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
Get the timestamp of the event.
# File lib/mongrel2/config/log.rb, line 61
Get a description of “how” the event happened.
# File lib/mongrel2/config/log.rb, line 65
Get the ID of the log entry
# File lib/mongrel2/config/log.rb, line 45
Get the “where” of the event.
# File lib/mongrel2/config/log.rb, line 57
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
Get a description of “what” happened
# File lib/mongrel2/config/log.rb, line 53
Get “who” was reponsible for the event.
# File lib/mongrel2/config/log.rb, line 49
Get a description of “why” the event happened.
# File lib/mongrel2/config/log.rb, line 71