GeoEco.Logging.Logger.SetLogErrorsAsWarnings
- classmethod Logger.SetLogErrorsAsWarnings(logErrorsAsWarnings)
Enable or disable the logging of errors as warnings.
Error messages describe failures that halt processing and require the user to fix a problem and restart processing. ArcGIS highlights error messages in red in its user interface, and fails geoprocessing if even one error is reported.
Sometimes you don’t want to halt processing when an unimportant operation fails. For example, you may not care that a temporary file could not be deleted. To prevent that unimportant failure from being logged as an error and potentially stopping processing, you can force errors to be logged as warnings like this:
oldValue = Logger.SetLogErrorsAsWarnings(True) try: # Do your work here finally: Logger.SetLogErrorsAsWarnings(oldValue)
- Parameters:
logErrorsAsWarnings (
bool) – If True, errors will now be logged as warnings. If False, errors will be logged as errors.- Returns:
Value of logErrorsAsWarnings prior to this function being called. Capture this if you want to call
SetLogErrorsAsWarnings()again to restore the old value.- Return type: