Sha256: 82cb5ccbe4fbcff9b0d0cbe5ac7dbdfaa8b68a4166f932622f4e83db59b45fc6

Contents?: true

Size: 531 Bytes

Versions: 6

Compression:

Stored size: 531 Bytes

Contents

# frozen_string_literal: true

class UniformNotifier
  class CustomizedLogger < Base
    @logger = nil

    def self.active?
      @logger
    end

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

    def self.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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
uniform_notifier-1.14.0 lib/uniform_notifier/customized_logger.rb
uniform_notifier-1.13.2 lib/uniform_notifier/customized_logger.rb
uniform_notifier-1.13.1 lib/uniform_notifier/customized_logger.rb
uniform_notifier-1.13.0 lib/uniform_notifier/customized_logger.rb
uniform_notifier-1.12.1 lib/uniform_notifier/customized_logger.rb
uniform_notifier-1.12.0 lib/uniform_notifier/customized_logger.rb