Sha256: 5bdf3826cefbeda049fdf3285074bf0d281c78f9b6db29ef0247f8b8dea5c734

Contents?: true

Size: 981 Bytes

Versions: 1

Compression:

Stored size: 981 Bytes

Contents

# frozen_string_literal: true

module Sbmt
  module Strangler
    class Logger
      delegate :logger, to: :Rails
      delegate_missing_to :logger

      def log_debug(message, **params)
        with_tags(**params) do
          logger.debug(message)
        end
      end

      def log_info(message, **params)
        with_tags(**params) do
          logger.info(message)
        end
      end

      def log_warn(message, **params)
        with_tags(**params) do
          logger.warn(message)
        end
      end

      def log_error(message, **params)
        with_tags(**params) do
          logger.error(message)
        end
      end

      def log_success(message, **params)
        log_info(message, status: "success", **params)
      end

      def log_failure(message, **params)
        log_error(message, status: "failure", **params)
      end

      def with_tags(**params)
        logger.tagged(**params) do
          yield
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
sbmt-strangler-0.9.1 lib/sbmt/strangler/logger.rb