Sha256: ff57977ed93da93fa11bbde839bce8e55fbde474b6476f3455aca83a7c00051c

Contents?: true

Size: 666 Bytes

Versions: 2

Compression:

Stored size: 666 Bytes

Contents

class ApplicationController < Sinatra::Base
  set :logger, Lumberjack::Logger.new

  configure :production do
    require 'fileutils'
    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_log = File.new File.join(log_path, 'stderr.log'), 'a+'
    $stderr.reopen stderr_log
    $stderr.sync = true

    # STDOUT logger
    stdout_log = File.new File.join(log_path, 'stdout.log'), 'a+'
    $stdout.reopen stdout_log
    $stdout.sync = true
  end

  helpers do
    def logger
      settings.logger
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eucalypt-0.1.3 lib/eucalypt/eucalypt-core/templates/eucalypt/config/logging.rb
eucalypt-0.1.2 lib/eucalypt/eucalypt-core/templates/eucalypt/config/logging.rb