Class Yell::Level
In: lib/yell/level.rb
Parent: Object

The Level class handles the severities for you in order to determine if an adapter should log or not.

In order to setup your level, you have certain modifiers available:

  at :warn    # will be set to :warn level only
  gt :warn    # Will set from :error level onwards
  gte :warn   # Will set from :warn level onwards
  lt :warn    # Will set from :info level an below
  lte :warn   # Will set from :warn level and below

You are able to combine those modifiers to your convenience.

@example Set from :info to :error (including)

  Yell::Level.new(:info).lte(:error)

@example Set from :info to :error (excluding)

  Yell::Level.new(:info).lt(:error)

@example Set at :info only

  Yell::Level.new.at(:info)

Methods

<=>   ==   at   at?   gt   gte   inspect   lt   lte   new   set   severities   to_i   to_int  

Included Modules

Comparable

Constants

InterpretRegexp = /(at|gt|gte|lt|lte)?\.?(#{Yell::Severities.join('|')})/i

Public Class methods

Create a new level instance.

@example Enable all severities

  Yell::Level.new

@example Pass the minimum possible severity

  Yell::Level.new :warn

@example Pass an array to exactly set the level at the given severities

  Yell::Level.new [:info, :error]

@example Pass a range to set the level within the severities

  Yell::Level.new (:info..:error)

@param [Integer,String,Symbol,Array,Range,nil] severity The severity for the level.

Public Instance methods

@private

Set the level at specific severities

@example Set at :debug and :error only

  at :debug, :error

@return [Yell::Level] the instance

Returns whether the level is allowed at the given severity

@example

  at? :warn
  at? 0       # debug

@return [Boolean] tru or false

Set the level to greater than the given severity

@example Set to :error and above

  gt :warn

@return [Yell::Level] the instance

Set the level greater or equal to the given severity

@example Set to :warn and above

  gte :warn

@return [Yell::Level] the instance

Get a pretty string representation of the level, including the severities.

Set the level lower than given severity

@example Set to lower than :warn

  lt :warn

@return [Yell::Level] the instance

Set the level lower or equal than given severity

@example Set to lower or equal than :warn

  lte :warn

@return [Yell::Level] the instance

Set the severity to the given format

to_i implements backwards compatibility

to_int()

Alias for to_i

[Validate]