Sha256: 13052aa82a60bb0c91c2270269817076236b5f2cc24c1d073ff7e29d3a3fdcd5

Contents?: true

Size: 727 Bytes

Versions: 12

Compression:

Stored size: 727 Bytes

Contents

# frozen_string_literal: true

module Pakyow
  module Actions
    # Sets up a connection logger and logs the prologue/epilogue.
    #
    class Logger
      def call(connection, &block)
        if silence?(connection)
          connection.logger.silence do
            call_with_logging(connection, &block)
          end
        else
          call_with_logging(connection, &block)
        end
      end

      private

      def call_with_logging(connection)
        connection.logger.prologue(connection)
        yield
        connection.logger.epilogue(connection)
      end

      def silence?(connection)
        Pakyow.silencers.any? { |silencer|
          silencer.call(connection)
        }
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
pakyow-core-1.0.6 lib/pakyow/actions/logger.rb
pakyow-core-1.0.5 lib/pakyow/actions/logger.rb
pakyow-core-1.0.4 lib/pakyow/actions/logger.rb
pakyow-core-1.0.3 lib/pakyow/actions/logger.rb
pakyow-core-1.0.2 lib/pakyow/actions/logger.rb
pakyow-core-1.0.1 lib/pakyow/actions/logger.rb
pakyow-core-1.0.0 lib/pakyow/actions/logger.rb
pakyow-core-1.0.0.rc5 lib/pakyow/environment/actions/logger.rb
pakyow-core-1.0.0.rc4 lib/pakyow/environment/actions/logger.rb
pakyow-core-1.0.0.rc3 lib/pakyow/environment/actions/logger.rb
pakyow-core-1.0.0.rc2 lib/pakyow/environment/actions/logger.rb
pakyow-core-1.0.0.rc1 lib/pakyow/environment/actions/logger.rb