lib/eucalypt/core/templates/eucalypt/config/logging.rb in eucalypt-0.3.4 vs lib/eucalypt/core/templates/eucalypt/config/logging.rb in eucalypt-0.3.5
- old
+ new
@@ -1,24 +1,25 @@
require 'fileutils'
class ApplicationController < Sinatra::Base
set :logger, Lumberjack::Logger.new
helpers { def logger() settings.logger end }
- #= General logging =#
- %i[production test].each do |e|
- configure e do
+ # General logging
+ %i[production test].each do |app_env|
+ configure app_env do
use Rack::CommonLogger, $stdout
- log_path = Eucalypt.path 'log', Time.now.strftime("%Y-%m-%dT%H-%M-%S_%z").sub(/_\+/, ?p).sub(/_\-/, ?m)
+ time = Time.now.strftime("%Y-%m-%dT%H-%M-%S_%z")
+ log_path = Eucalypt.path 'log', time.sub(/_\+/, ?p).sub(/_\-/, ?m)
FileUtils.mkdir_p log_path
- $stderr.reopen File.new(File.join(log_path, "#{e}.stderr.log"), 'a+')
+ $stderr.reopen File.new(File.join(log_path, "#{app_env}.stderr.log"), 'a+')
$stderr.sync = true
- $stdout.reopen File.new(File.join(log_path, "#{e}.stdout.log"), 'a+')
+ $stdout.reopen File.new(File.join(log_path, "#{app_env}.stdout.log"), 'a+')
$stdout.sync = true
end
end
- #= ActiveRecord logging =#
+ # ActiveRecord logging
ActiveRecord::Base.logger = Logger.new STDOUT
ActiveRecord::Migration.verbose = true # Set to false for quieter logging
end
\ No newline at end of file