Sha256: 75ec65c7a4b1e991e844872fe1d2e5d3a69d023df6aa2efa899b026a9401561c

Contents?: true

Size: 898 Bytes

Versions: 27

Compression:

Stored size: 898 Bytes

Contents

module Riak
  class Node
    LAGER_LEVELS = [
                    :debug,
                    :info,
                    :notice,
                    :warning,
                    :error,
                    :critical,
                    :alert,
                    :emergency
                   ]

    def read_console_log(*levels)
      console_log = log + 'console.log'
      if console_log.exist?
        levels = levels.map { |level| expand_log_level(level) }.compact.flatten
        pattern = /(#{levels.map { |level| "\\[#{level}\\]" }.join("|")})/
        console_log.readlines.grep(pattern)
      end
    end

    def expand_log_level(level)
      case level
      when Range
        first = LAGER_LEVELS.index(level.begin.to_sym) || 0
        last = LAGER_LEVELS.index(level.end.to_sym) || -1
        LAGER_LEVELS[first..last]
      when Symbol
        level
      end
    end
  end
end

Version data entries

27 entries across 17 versions & 2 rubygems

Version Path
riak-client-1.4.5 lib/riak/node/log.rb
riak-client-1.4.4.1 lib/riak/node/log.rb
riak-client-1.4.4 lib/riak/node/log.rb
riak-client-1.4.3 lib/riak/node/log.rb
riak-client-1.4.2 lib/riak/node/log.rb
riak-client-1.4.1 lib/riak/node/log.rb
riak-client-1.4.0 lib/riak/node/log.rb
riak-client-1.2.0 lib/riak/node/log.rb
riak-client-1.1.1 lib/riak/node/log.rb
riak-client-1.1.0 lib/riak/node/log.rb
better-riak-client-1.0.7 lib/riak/node/log.rb
better-riak-client-1.0.6 lib/riak/node/log.rb
riak-client-1.0.5 lib/riak/node/log.rb
better-riak-client-1.0.5 lib/riak/node/log.rb
riak-client-1.0.3 pkg/riak-client-1.0.2/pkg/riak-client-1.0.1/lib/riak/node/log.rb
riak-client-1.0.3 pkg/riak-client-1.0.2/pkg/riak-client-1.0.0/lib/riak/node/log.rb
riak-client-1.0.3 pkg/riak-client-1.0.2/lib/riak/node/log.rb
riak-client-1.0.3 pkg/riak-client-1.0.1/pkg/riak-client-1.0.0/lib/riak/node/log.rb
riak-client-1.0.3 pkg/riak-client-1.0.1/lib/riak/node/log.rb
riak-client-1.0.3 pkg/riak-client-1.0.0/lib/riak/node/log.rb