Sha256: 4be96b14ede51c1c20180f9f0c4629af099f039491dfb022251ad58597e4b9c2

Contents?: true

Size: 625 Bytes

Versions: 1

Compression:

Stored size: 625 Bytes

Contents

# frozen_string_literal: true

require "logger"
require "bridgetown-core/log_writer"

module Bridgetown
  module Rack
    class Logger < Bridgetown::LogWriter
      def self.message_with_prefix(msg)
        "\e[35m[Server]\e[0m #{msg}"
      end

      def enable_prefix
        @formatter = proc do |_, _, _, msg|
          self.class.message_with_prefix(msg)
        end
      end

      def add(severity, message = nil, progname = nil)
        return if progname&.include?("/_bridgetown/live_reload")

        super
      end

      def initialize(*_args)
        super()
        enable_prefix
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bridgetown-core-2.0.0.beta3 lib/bridgetown-core/rack/logger.rb