Sha256: 8df4554b63107fd992e12a0d6e1f46a1a5b20b6784d8055a68b7fa0a059d4b33

Contents?: true

Size: 829 Bytes

Versions: 1

Compression:

Stored size: 829 Bytes

Contents

# encoding: UTF-8
#
# Copyright (c) 2010-2017 GoodData Corporation. All rights reserved.
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree.

require 'logger'

require_relative 'base_middleware'

module GoodData
  module Bricks
    class LoggerMiddleware < Bricks::Middleware
      def call(params)
        params = params.to_hash
        logger = nil
        if params['GDC_LOGGING_OFF']
          logger = NilLogger.new
        else
          logger = params['GDC_LOGGER'] = params[:GDC_LOGGER_FILE].nil? ? Logger.new(STDOUT) : Logger.new(params[:GDC_LOGGER_FILE])
          logger.info('Pipeline starts')
        end
        returning(@app.call(params)) do |_result|
          logger.info('Pipeline ending')
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gooddata-0.6.50 lib/gooddata/bricks/middleware/logger_middleware.rb