Table of Contents

 
SetFilter
 

Purpose

Sets the filter that determines what error types not to display in the log

 

Protoype

void CError::SetFilter (filter v_filter_type = filter(), filter v_filter_file = filter())
 

Parameters

filter_type array of error types to ignore
filter_file array of file names to ignore
 

Description

The reason there are so many different error types listed in LogItem() is so you can better categorize errors to filter them out of a log. The function takes an array of error types (in the form of an STL vector) and uses that to create the filter list. When an error type is on the filter list, any and all errors of that type reported with LogItem() will be ignored and not logged. If you want to clear all types from the filter, pass in an empty parameter set. If you want to remove an error type, you must pass in the entire list minus the type you now want displayed in the log. In addition, you can also specify which files you don't want any reports logged from. You must include the full file name plus extension, like for instance: "cspritemngr.cpp". Full path info is not required. This function is not intended for real-time use (constant in-game changing of filters) and it's really better to use LoadConfig() instead.

NOTE: The function will not allow the filtering of types ERR_FATAL_APP, ERR_FATAL_SYS, ERR_WARNING_APP, ERR_WARNING_SYS and ERR_CATCH (a special internal type for when an exception is thrown after an ERR_FATAL event)

NOTE: Depending on how you use error logging, log files can get very big very fast, so it is recommended that you filter out ERR_COMMON, ERR_DEBUG, and ERR_STATUS unless you are debugging or beta-testing an application.

 

Use

CError error;
// build filter
filter v_filter;
filter.push_back(ERR_DEBUG);
filter.push_back(ERR_COMMON_SYS);
filter.push_back(ERR_COMMON_APP);
// create the filter
error.SetFilter(v_filter);
// clear the filter
error.SetFilter(); 
 

Prev: SDLFailed