lib/oslg/oslog.rb in oslg-0.2.3 vs lib/oslg/oslog.rb in oslg-0.2.4

- old
+ new

@@ -167,18 +167,18 @@ end ## # Log template 'invalid object' message and return user-set object. # - # @param id [String] empty object identifier + # @param id [String] invalid object identifier # @param mth [String] calling method identifier # @param ord [String] calling method argument order number of obj (optional) # @param lvl [Integer] DEBUG, INFO, WARN, ERROR or FATAL (optional) # @param res [Object] what to return (optional) # - # @return [Object] res if specified by user - # @return [Nil] nil if return object is invalid + # @return [Object] return object if specified by user + # @return [Nil] nil if return object missing or invalid def invalid(id = "", mth = "", ord = 0, lvl = DEBUG, res = nil) return nil unless defined?(res) return res unless defined?(id ) && id return res unless defined?(mth) && mth return res unless defined?(ord) && ord @@ -198,19 +198,19 @@ end ## # Log template 'instance/class mismatch' message and return user-set object. # - # @param id [String] empty object identifier + # @param id [String] mismatched object identifier # @param obj [Object] object to validate # @param cl [Class] target class # @param mth [String] calling method identifier # @param lvl [Integer] DEBUG, INFO, WARN, ERROR or FATAL (optional) # @param res [Object] what to return (optional) # - # @return [Object] res if specified by user - # @return [Nil] nil if return object is invalid + # @return [Object] return object if specified by user + # @return [Nil] nil if return object missing or invalid def mismatch(id = "", obj = nil, cl = nil, mth = "", lvl = DEBUG, res = nil) return nil unless defined?(res) return res unless defined?(id ) && id return res unless defined?(obj) && obj return res unless defined?(cl ) && cl @@ -231,19 +231,19 @@ end ## # Log template 'missing hash key' message and return user-set object. # - # @param id [String] empty object identifier + # @param id [String] Hash identifier # @param hsh [Hash] hash to validate - # @param key [Object] target key + # @param key [Object] missing key # @param mth [String] calling method identifier # @param lvl [Integer] DEBUG, INFO, WARN, ERROR or FATAL (optional) # @param res [Object] what to return (optional) # - # @return [Object] res if specified by user - # @return [Nil] nil if not specified by user (or invalid) + # @return [Object] return object if specified by user + # @return [Nil] nil if return object missing or invalid def hashkey(id = "", hsh = {}, key = "", mth = "", lvl = DEBUG, res = nil) return nil unless defined?(res) return res unless defined?(id ) && id return res unless defined?(hsh) && hsh return res unless defined?(key) && key @@ -255,11 +255,11 @@ id = id.to_s.strip id = id[0...60] + " ..." if id.length > 60 return res if id.empty? return mismatch(id, hsh, Hash, mth, lvl, res) unless hsh.is_a?(Hash) return res if hsh.key?(key) - msg = "'#{id}' Hash: no key '#{key}' (#{mth})" + msg = "Missing '#{key}' key in '#{id}' Hash (#{mth})" lvl = lvl.to_i unless lvl.is_a?(Integer) log(lvl, msg) if lvl >= DEBUG && lvl <= FATAL res end @@ -269,12 +269,12 @@ # @param id [String] empty object identifier # @param mth [String] calling method identifier # @param lvl [Integer] DEBUG, INFO, WARN, ERROR or FATAL (optional) # @param res [Object] what to return (optional) # - # @return [Object] res if specified by user - # @return [Nil] nil if return object is invalid + # @return [Object] return object if specified by user + # @return [Nil] nil if return object missing or invalid def empty(id = "", mth = "", lvl = DEBUG, res = nil) return nil unless defined?(res) return res unless defined?(id ) && id return res unless defined?(mth) && mth return res unless defined?(lvl) && lvl @@ -291,17 +291,17 @@ end ## # Log template 'near zero' message and return user-set object. # - # @param id [String] empty object identifier + # @param id [String] zero object identifier # @param mth [String] calling method identifier # @param lvl [Integer] DEBUG, INFO, WARN, ERROR or FATAL (optional) # @param res [Object] what to return (optional) # - # @return [Object] res if specified by user - # @return [Nil] nil if return object is invalid + # @return [Object] return object if specified by user + # @return [Nil] nil if return object missing or invalid def zero(id = "", mth = "", lvl = DEBUG, res = nil) return nil unless defined?(res) return res unless defined?(id ) && id return res unless defined?(mth) && mth return res unless defined?(lvl) && lvl @@ -309,26 +309,26 @@ mth = mth[0...60] + " ..." if mth.length > 60 return res if mth.empty? id = id.to_s.strip id = id[0...60] + " ..." if id.length > 60 return res if id.empty? - msg = "'#{id}' ~zero (#{mth})" + msg = "Zero '#{id}' (#{mth})" lvl = lvl.to_i unless lvl.is_a?(Integer) log(lvl, msg) if lvl >= DEBUG && lvl <= FATAL res end ## # Log template 'negative' message and return user-set object. # - # @param id [String] empty object identifier + # @param id [String] negative object identifier # @param mth [String] calling method identifier # @param lvl [Integer] DEBUG, INFO, WARN, ERROR or FATAL (optional) # @param res [Object] what to return (optional) # - # @return [Object] res if specified by user - # @return [Nil] nil if return object is invalid + # @return [Object] return object if specified by user + # @return [Nil] nil if return object missing or invalid def negative(id = "", mth = "", lvl = DEBUG, res = nil) return nil unless defined?(res) return res unless defined?(id ) && id return res unless defined?(mth) && mth return res unless defined?(lvl) && lvl @@ -336,10 +336,10 @@ mth = mth[0...60] + " ..." if mth.length > 60 return res if mth.empty? id = id.to_s.strip id = id[0...60] + " ..." if id.length > 60 return res if id.empty? - msg = "'#{id}' negative (#{mth})" + msg = "Negative '#{id}' (#{mth})" lvl = lvl.to_i unless lvl.is_a?(Integer) log(lvl, msg) if lvl >= DEBUG && lvl <= FATAL res end