:orphan:
# PetscOptionsMonitorSet
Sets an ADDITIONAL function to be called at every method that modified the PETSc options database. 
## Synopsis
```
#include "petscsys.h"   
PetscErrorCode PetscOptionsMonitorSet(PetscErrorCode (*monitor)(const char name[], const char value[], PetscOptionSource, void *), void *mctx, PetscErrorCode (*monitordestroy)(void **))
```
Not Collective


## Input Parameters

- ***monitor -*** pointer to function (if this is `NULL`, it turns off monitoring
- ***mctx    -*** [optional] context for private data for the
monitor routine (use `NULL` if no context is desired)
- ***monitordestroy -*** [optional] routine that frees monitor context
(may be `NULL`)



## Calling Sequence of `monitor`
```none
PetscErrorCode monitor(const char name[], const char value[], void *mctx)
```

- ***name -*** option name string
- ***value -*** option value string
- ***source -*** option source
- ***mctx  -*** optional monitoring context, as set by `PetscOptionsMonitorSet()`



## Calling Sequence of `monitordestroy`
```none
PetscErrorCode monitordestroy(void *cctx)
```


## Options Database Key
See `PetscInitialize()` for options related to option database monitoring.




## Notes
The default is to do nothing.  To print the name and value of options
being inserted into the database, use `PetscOptionsMonitorDefault()` as the monitoring routine,
with a null monitoring context.

Several different monitoring routines may be set by calling
`PetscOptionsMonitorSet()` multiple times; all will be called in the
order in which they were set.


## See Also
 `PetscOptionsMonitorDefault()`, `PetscInitialize()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/objects/options.c.html#PetscOptionsMonitorSet">src/sys/objects/options.c</A>


---
[Edit on GitLab](https://gitlab.com/petsc/petsc/-/edit/release/src/sys/objects/options.c)


[Index of all Sys routines](index.md)  
[Table of Contents for all manual pages](/manualpages/index.md)  
[Index of all manual pages](/manualpages/singleindex.md)  
