Sha256: 72dbba333ecec55ccccd5b83fba5b0a15cbbae6ac0cfeb9f2976eef5264158c6

Contents?: true

Size: 572 Bytes

Versions: 4

Compression:

Stored size: 572 Bytes

Contents

# frozen_string_literal: true

class UniformNotifier
  class CustomizedLogger < Base
    class << self
      @logger = nil

      def active?
        @logger
      end

      def _out_of_channel_notify(data)
        message = data.values.compact.join("\n")
        @logger.warn message
      end

      def setup(logdev)
        require 'logger'

        @logger = Logger.new(logdev)

        def @logger.format_message(severity, timestamp, _progname, msg)
          "#{timestamp.strftime('%Y-%m-%d %H:%M:%S')}[#{severity}] #{msg}"
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
uniform_notifier-1.16.0 lib/uniform_notifier/customized_logger.rb
uniform_notifier-1.15.0 lib/uniform_notifier/customized_logger.rb
uniform_notifier-1.14.2 lib/uniform_notifier/customized_logger.rb
uniform_notifier-1.14.1 lib/uniform_notifier/customized_logger.rb