Sha256: d99eccdb05e0e9bb507ea9ef8238152d7db248201928642466bc2185d3f4ceed

Contents?: true

Size: 785 Bytes

Versions: 2

Compression:

Stored size: 785 Bytes

Contents

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
      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.reopen File.new(File.join(log_path, "#{e}.stderr.log"), 'a+')
      $stderr.sync = true
      $stdout.reopen File.new(File.join(log_path, "#{e}.stdout.log"), 'a+')
      $stdout.sync = true
    end
  end

  #= ActiveRecord logging =#
  ActiveRecord::Base.logger = Logger.new STDOUT
  ActiveRecord::Migration.verbose = true # Set to false for quieter logging
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eucalypt-0.3.4 lib/eucalypt/core/templates/eucalypt/config/logging.rb
eucalypt-0.3.3 lib/eucalypt/core/templates/eucalypt/config/logging.rb