Skip to content

Instantly share code, notes, and snippets.

@michaelklishin
Created August 6, 2008 03:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michaelklishin/4163 to your computer and use it in GitHub Desktop.
Save michaelklishin/4163 to your computer and use it in GitHub Desktop.
# ==== Returns
# String::
# The path to the log file. If this Merb instance is running as a daemon
# this will return +STDOUT+.
def log_file
if Merb::Config[:log_file]
Merb::Config[:log_file]
elsif Merb.testing?
log_path / "merb_test.log"
elsif !(Merb::Config[:daemonize] || Merb::Config[:cluster])
STDOUT
else
log_path / "merb.#{Merb::Config[:port]}.log"
end
end
# ==== Returns
# String:: Path to directory that contains the log file.
def log_path
path = case Merb::Config[:log_file]
when String then File.dirname(Merb::Config[:log_file])
else Merb.root_path("log")
end
Pathname.new(path)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment