lib/eucalypt/core/templates/eucalypt/config/logging.rb in eucalypt-0.3.2 vs lib/eucalypt/core/templates/eucalypt/config/logging.rb in eucalypt-0.3.3
- old
+ new
@@ -1,27 +1,24 @@
+require 'fileutils'
class ApplicationController < Sinatra::Base
set :logger, Lumberjack::Logger.new
+ helpers { def logger() settings.logger end }
- require 'fileutils'
+ #= General logging =#
%i[production test].each do |e|
configure e do
use Rack::CommonLogger, $stdout
log_path = Eucalypt.path 'log', Time.now.strftime("%Y-%m-%dT%H-%M-%S_%z").sub(/_\+/, ?p).sub(/_\-/, ?m)
FileUtils.mkdir_p log_path
- # STDERR logger
$stderr.reopen File.new(File.join(log_path, "#{e}.stderr.log"), 'a+')
$stderr.sync = true
-
- # STDOUT logger
$stdout.reopen File.new(File.join(log_path, "#{e}.stdout.log"), 'a+')
$stdout.sync = true
end
end
- helpers do
- def logger
- settings.logger
- end
- end
+ #= 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