Sha256: 6c045a65b5247b3c3a91bc5b13c81d688548bfd2ead585f6fd3e7d0cde7511b7

Contents?: true

Size: 624 Bytes

Versions: 1

Compression:

Stored size: 624 Bytes

Contents

module Rack
  module SimpleAuth
    # class Logger
    # This class receives a logpath, env and message and
    # prints the message to the specified logpath for the proper env file (eg.: /path/to/file/test_error.log for test env)
    module Logger
      def self.log(logpath, env = 'development', msg)
        system("mkdir #{logpath}") unless Dir.exist?("#{logpath}")
        open("#{logpath}/#{env}_error.log", 'a') do |f|
          f << "#{msg}\n"
        end

        # Print out log to stdout for dev env
        puts msg if ENV['RACK_ENV'].eql?('development')
      end
    end # Logger
  end # SimpleAuth
end # Rack

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rack-simple_auth-1.0.0rc lib/rack/simple_auth/logger.rb