PetscErrorPrintf#
Prints error messages.
Synopsis#
#include <petscsys.h>
PetscErrorCode (*PetscErrorPrintf)(const char format[], ...);
Not Collective; No Fortran Support
Input Parameter#
format - the usual
printf()format string
Options Database Keys#
-error_output_stdout - cause error messages to be printed to stdout instead of the (default) stderr
-error_output_none - to turn off all printing of error messages (does not change the way the error is handled.)
Notes#
Use
PetscErrorPrintf = PetscErrorPrintfNone; to turn off all printing of error messages (does not change the way the error is handled) and
PetscErrorPrintf = PetscErrorPrintfDefault; to turn it back on or you can use your own function
Use
PETSC_STDERR = FILE* obtained from a file open etc. to have stderr printed to the file.
PETSC_STDOUT = FILE* obtained from a file open etc. to have stdout printed to the file.
You can change how error messages are printed by replacing the function pointer with your own function, for example,
where mylogfile is a FILE the application has opened,
PetscErrorCode MyErrorPrintf(const char format[], ...)
{
va_list Argp;
// do not use PetscFunctionBegin here, this is called while an error is being handled
va_start(Argp, format);
(void)vfprintf(mylogfile, format, Argp);
va_end(Argp);
return PETSC_SUCCESS;
}
then set
PetscErrorPrintf = MyErrorPrintf;
Use
`PetscPushErrorHandler()` to provide your own error handler that determines what kind of messages to print
See Also#
PetscFPrintf(), PetscSynchronizedPrintf(), PetscHelpPrintf(), PetscPrintf(), PetscPushErrorHandler(), PetscVFPrintf(),
PetscErrorPrintfNone(), PetscErrorPrintfDefault()
Level#
developer
Location#
Examples#
Index of all Sys routines
Table of Contents for all manual pages
Index of all manual pages