support/ruby/collins-client/lib/collins/api/logging.rb
# Log a message against an asset using the specified level
# @param [String,Collins::Asset] asset_or_tag
# @param [String] message
# @param [Severity] level severity level to use
# @return [OpenStruct] The log struct created
# @raise [Collins::ExpectationFailed] the specified level was invalid
# @raise [Collins::RequestError,Collins::UnexpectedResponseError] if the asset or message invalid
Log a message against an asset using the specified level
Log a message against an asset using the specified level
def log! asset_or_tag, message, level = nil
      asset = get_asset_or_tag asset_or_tag
      parameters = {
        :message => message,
        :type => log_level_from_string(level)
      }
      parameters = select_non_empty_parameters parameters
      logger.debug("Logging to #{asset.tag} with parameters #{parameters.inspect}")
      http_put("/api/asset/#{asset.tag}/log", parameters, asset.location) do |response|
        parse_response response, :as => :paginated, :expects => 201 do |json|
          OpenStruct.new(symbolize_hash(json))
        end
      end
    end
def log! asset_or_tag , message , level = nil asset = get_asset_or_tag asset_or_tag parameters = { :message => message , :type => log_level_from_string ( level ) } parameters = select_non_empty_parameters parameters logger . debug ( "Logging to #{asset.tag} with parameters #{parameters.inspect}" ) http_put ( "/api/asset/#{asset.tag}/log" , parameters , asset . location ) do | response | parse_response response , :as => :paginated , :expects => 201 do | json | OpenStruct . new ( symbolize_hash ( json ) ) end end end
Log a message against an asset using the specified level
Log a message against an asset using the specified level
The log struct created
The log struct created
OpenStruct
[Collins::ExpectationFailed] the specified level was invalid
[ Collins :: ExpectationFailed ] the specified level was invalid
[Collins::RequestError,Collins::UnexpectedResponseError] if the asset or message invalid
[ Collins :: RequestError Collins :: UnexpectedResponseError ] if the asset or message invalid
asset_or_tag
message
level
level severity level to use
level severity level to use