Sha256: 0075af473f193ea591688389af523dcfcab1bc7536d7abddb2fd302c3213e5dc

Contents?: true

Size: 760 Bytes

Versions: 1

Compression:

Stored size: 760 Bytes

Contents

# frozen_string_literal: true

require "hanami/logger"

module Hanami
  module Model
    class Migrator
      # Automatic logger for migrations
      #
      # @since 1.0.0
      # @api private
      class Logger < Hanami::Logger
        # Formatter for migrations logger
        #
        # @since 1.0.0
        # @api private
        class Formatter < Hanami::Logger::Formatter
          private

          # @since 1.0.0
          # @api private
          def _format(hash)
            "[hanami] [#{hash.fetch(:severity)}] #{hash.fetch(:message)}\n"
          end
        end

        # @since 1.0.0
        # @api private
        def initialize(stream)
          super(nil, stream: stream, formatter: Formatter.new)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
hanami-model-1.3.3 lib/hanami/model/migrator/logger.rb