Class: Log::Verbosity Deprecated

Inherits:
Object
  • Object
show all
Defined in:
lib/ec2/amitools/util.rb

Overview

Deprecated.

use Priority instead

Constant Summary collapse

V0 =

Unhandled exceptions only.

new 0
V1 =

As for 0 but with error messages.

new 1
V2 =

As for 1 but with informational messages.

new 2
V3 =

As for 2 but with XML-RPC logging.

new 3
V4 =

As for 3 but with Xen logging.

new 4
V5 =

As for 4 but with debugging messages.

new 5
@@levels =
Hash.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ Verbosity

Returns a new instance of Verbosity.



121
122
123
124
# File 'lib/ec2/amitools/util.rb', line 121

def initialize value
  @value = value
  @@levels[value] = self
end

Instance Attribute Details

#valueObject

Returns the value of attribute value.



133
134
135
# File 'lib/ec2/amitools/util.rb', line 133

def value
  @value
end

Class Method Details

.from_string(s) ⇒ Object



139
140
141
142
143
144
145
146
# File 'lib/ec2/amitools/util.rb', line 139

def Verbosity.from_string s
  level = s.to_i
  if not @@levels[level]
    raise ArgumentError.new("invalid logging verbosity level #{level}")
  else
    @@levels[level]
  end
end

Instance Method Details

#>=(operand) ⇒ Object



135
136
137
# File 'lib/ec2/amitools/util.rb', line 135

def >= operand
  @value >= operand.value
end

#to_priorityObject



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/ec2/amitools/util.rb', line 148

def to_priority
  case self
  when V0
    return Priority::ALERT
  when V1
    return Priority::ERR
  when V2
    return Priority::WARNING
  when V3
    return Priority::NOTICE
  when V4
    return Priority::INFO
  else
    return Priority::DEBUG
  end
end