Sha256: 5e869576c6224ace298961f072ac4bfa3f898519b6a2ff8318058d1e6600f42c
Contents?: true
Size: 746 Bytes
Versions: 2
Compression:
Stored size: 746 Bytes
Contents
module Low module Middleware class RackErrors DEFAULT_FS_ENVS = ['development', 'test'] def initialize(app, opts = {}) @app = app @fs_envs = opts[:fs_envs] || DEFAULT_FS_ENVS end def call(env) env['rack.errors'] = io @app.call(env) end def io # If `RACK_ENV` should log to the FS, if @fs_envs.include? ENV['RACK_ENV'] # make sure the log directory exists, Dir.mkdir('log') unless Dir.exists?('log') # and log to an eponymous file; File.open("log/#{ENV['RACK_ENV']}.log", 'a') else # otherwise, log to STDOUT (Heroku likes it this way). STDOUT end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
low-0.0.12 | lib/low/middleware/rack_errors.rb |
low-0.0.11 | lib/low/middleware/rack_errors.rb |