Sha256: 094d6cdbaf88b21d898a8e93c481b8be5d8f1b8c42458a60918c0ee7c12703ac

Contents?: true

Size: 495 Bytes

Versions: 1

Compression:

Stored size: 495 Bytes

Contents

# frozen_string_literal: true

module Hanami
  module Providers
    # @api private
    # @since 2.2.0
    class DBLogging < Dry::System::Provider::Source
      # @api private
      # @since 2.2.0
      def prepare
        require "dry/monitor/sql/logger"
        target["notifications"].register_event :sql
      end

      # @api private
      # @since 2.2.0
      def start
        Dry::Monitor::SQL::Logger.new(target["logger"]).subscribe(target["notifications"])
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hanami-2.2.0.beta1 lib/hanami/providers/db_logging.rb