Sha256: 250651448f8c775039be4e3dc6127b48ad3b03c2853e2b0ecaa63f8bdfd01c45

Contents?: true

Size: 662 Bytes

Versions: 4

Compression:

Stored size: 662 Bytes

Contents

require 'logger'
require 'fileutils'

module Soaspec

  # Handles logs of API requests and responses
  class SpecLogger
    class << self
      def create
        unless File.exist?('logs/traffic.log')
          FileUtils.mkdir_p 'logs'
          FileUtils.touch File.join('logs', 'traffic.log')
        end
        @logger = Logger.new('logs/traffic.log') # Where request and responses of APIs are stored
        @logger.level = Logger::DEBUG
        @logger
      end

      # Log a message using Soaspec logger
      # @param [String] message The message to add to the logger
      def info(message)
        @logger.info(message)
      end
    end

  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
soaspec-0.1.0 lib/soaspec/spec_logger.rb
soaspec-0.0.89 lib/soaspec/spec_logger.rb
soaspec-0.0.87 lib/soaspec/spec_logger.rb
soaspec-0.0.86 lib/soaspec/spec_logger.rb