class GorgService::LogMessage

Attributes

error_name[RW]

@return [String] Name identifying the error

error_type[RW]

@return [String] Error type ('hardfail','softfail')

level[RW]

@return [String] Level of the log 0 => DEBUG 1 => INFO 2 => WARNING 3 => SOFTFAIL 4 => HARDFAIL

next_try_in[RW]

@return [Integer] Time until next attempts in milliseconds

Public Class Methods

new(opts={}) click to toggle source

@param opts [Hash] Attributes of the message @option opts [String] :level See {#level}. Default : 1 @option opts [String] :error_type See {#error_type}. Default : nil @option opts [Integer] :next_try_in See {#next_try_in}. Default : nil @option opts [String] :error_name See {#error_name}. Default : nil @see GorgService::Message#initialize

Calls superclass method
# File lib/gorg_service/log_message.rb, line 30
def initialize(opts={})
  super
  self.level= opts.fetch(:level,1)
  self.error_type=  opts.fetch(:error_type,nil)
  self.next_try_in= opts.fetch(:next_try_in,nil)
  self.error_name=  opts.fetch(:error_name,nil)
end

Public Instance Methods

type() click to toggle source
# File lib/gorg_service/log_message.rb, line 20
def type
  "log"
end
validate() click to toggle source
Calls superclass method
# File lib/gorg_service/log_message.rb, line 38
def validate
  self.validation_errors[:level]+=["is null"] unless self.level
  self.validation_errors[:level]+=["is not in [0,1,2,3,4]"] unless (0..4).to_a.include?(self.level)
  self.validation_errors[:error_type]+=["is not in (softfail hardfail)"] unless self.error_type && (%w(softfail hardfail).include? self.error_type)
  super
end