Sha256: afaefeba017fc0600db095fe4bb0bf656982fa0b894a6dd96ca1eeec74d11983

Contents?: true

Size: 645 Bytes

Versions: 33

Compression:

Stored size: 645 Bytes

Contents

require 'logger'
require 'pathname'

module PactBroker

  module Logging

    # Need to make this configurable based on the calling app!
    LOG_DIR = Pathname.new(File.join(File.dirname(__FILE__), '..', '..', 'log')).cleanpath
    LOG_FILE_NAME = "#{ENV['RACK_ENV'] || 'development'}.log"

    def self.included(base)
      base.extend(self)
    end

    def logger= logger
      @@logger = logger
    end

    def logger
      @@logger ||= begin
        FileUtils.mkdir_p(LOG_DIR)
        logger = Logger.new(File.join(LOG_DIR, LOG_FILE_NAME))
        logger.level = Logger::DEBUG
        logger
      end
    end
  end

  include Logging
end

Version data entries

33 entries across 33 versions & 1 rubygems

Version Path
pact_broker-2.0.0.beta.6 lib/pact_broker/logging.rb
pact_broker-2.0.0.beta.5 lib/pact_broker/logging.rb
pact_broker-1.18.0.beta.1 lib/pact_broker/logging.rb
pact_broker-1.17.2 lib/pact_broker/logging.rb
pact_broker-1.17.1 lib/pact_broker/logging.rb
pact_broker-2.0.0.beta.4 lib/pact_broker/logging.rb
pact_broker-2.0.0.beta.3 lib/pact_broker/logging.rb
pact_broker-2.0.0.beta.2 lib/pact_broker/logging.rb
pact_broker-2.0.0.beta.1 lib/pact_broker/logging.rb
pact_broker-1.17.0 lib/pact_broker/logging.rb
pact_broker-1.16.0 lib/pact_broker/logging.rb
pact_broker-1.15.0 lib/pact_broker/logging.rb
pact_broker-1.14.0 lib/pact_broker/logging.rb
pact_broker-1.13.0 lib/pact_broker/logging.rb
pact_broker-1.12.0 lib/pact_broker/logging.rb
pact_broker-1.11.2 lib/pact_broker/logging.rb
pact_broker-1.11.1 lib/pact_broker/logging.rb
pact_broker-1.11.0 lib/pact_broker/logging.rb
pact_broker-1.10.0 lib/pact_broker/logging.rb
pact_broker-1.9.3 lib/pact_broker/logging.rb