lib/eucalypt/core/templates/eucalypt/config/logging.rb in eucalypt-0.3.5 vs lib/eucalypt/core/templates/eucalypt/config/logging.rb in eucalypt-0.4.0

- old
+ new

@@ -1,15 +1,19 @@ require 'fileutils' class ApplicationController < Sinatra::Base set :logger, Lumberjack::Logger.new helpers { def logger() settings.logger end } - # General logging - %i[production test].each do |app_env| + configure(:test) { disable :logging } + configure(:development) { enable :logging } + + # Environments where STDOUT should be redirected to log file + %i[production].each do |app_env| configure app_env do + enable :logging use Rack::CommonLogger, $stdout - time = Time.now.strftime("%Y-%m-%dT%H-%M-%S_%z") + time = Time.now.strftime("%Y-%m-%d_%H-%M-%S") log_path = Eucalypt.path 'log', time.sub(/_\+/, ?p).sub(/_\-/, ?m) FileUtils.mkdir_p log_path $stderr.reopen File.new(File.join(log_path, "#{app_env}.stderr.log"), 'a+') $stderr.sync = true \ No newline at end of file