Created
August 6, 2008 03:55
-
-
Save michaelklishin/4163 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ==== 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