Sha256: c763a9feab0c44a47c8f78dfa95836af24bb3ff2c33e9c9c79d4f29009bd1a4c
Contents?: true
Size: 801 Bytes
Versions: 2
Compression:
Stored size: 801 Bytes
Contents
# frozen_string_literal: true module RubySmart module SimpleLogger module Extensions module Logs # returns the logdev logs # @return [Array] def logs return [] unless logdev.dev.respond_to?(:logs) logdev.dev.logs end # transforms the logs-array into a hash of logs, grouped by level (:error, :success, ...) # @return [Hash] logs def logs_to_h logs.reduce({}) do |m, log| m[log[0]] ||= [] m[log[0]] << log[2] m end end # returns a hash with total amounts per logged type (key) # @return [Hash] def log_stats logs_to_h.reduce({}) { |m, (sev, logs)| m[sev] = logs.count; m } end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ruby_smart-simple_logger-1.1.1 | lib/ruby_smart/simple_logger/extensions/logs.rb |
ruby_smart-simple_logger-1.1.0 | lib/ruby_smart/simple_logger/extensions/logs.rb |