:orphan:
# PetscInfo
Logs informative data 
## Synopsis
```
#include <petscsys.h>
PetscErrorCode PetscInfo(PetscObject obj, const char message[])
PetscErrorCode PetscInfo(PetscObject obj, const char formatmessage[],arg1)
PetscErrorCode PetscInfo(PetscObject obj, const char formatmessage[],arg1,arg2)
...
```
Collective


## Input Parameters

- ***obj -*** object most closely associated with the logging statement or `NULL`
- ***message -*** logging message
- ***formatmessage -*** logging message using standard "printf" format
- ***arg1, arg2, ... -*** arguments of the format



## Options Database Key

- ***-info [filename][:[~]<list,of,classnames>[:[~]self]] -*** specify which informative messages are printed





## Notes
`PetscInfo()` prints only from the first processor in the communicator of `obj`.
If `obj` is `NULL`, the `PETSC_COMM_SELF` communicator is used, i.e. every rank of `PETSC_COMM_WORLD` prints the message.

The optional <list,of,classnames> is a comma separated list of enabled classes, e.g. `vec,mat,ksp`.
If this list is not specified, all classes are enabled.
Prepending the list with ~ means inverted selection, i.e. all classes except the listed are enabled.
A special classname `sys` relates to `PetscInfo()` with `obj` being `NULL`.

The optional keyword `self` specifies that `PetscInfo()` is enabled only for a communicator size of 1 (e.g. `PETSC_COMM_SELF`).
By contrast, ~self means that `PetscInfo()` is enabled only for communicator size > 1 (e.g. `PETSC_COMM_WORLD`), i.e. those `PetscInfo()` calls which print from every rank of `PETSC_COMM_WORLD` are disabled.

All classname/self matching is case insensitive. Filename is case sensitive.


## Example of Usage
```none
     Mat A;
     PetscInt alpha;
     ...
     PetscInfo(A,"Matrix uses parameter alpha=%" PetscInt_FMT "\n",alpha);
```



## Options Examples
Each call of the form
```none
     PetscInfo(obj, msg);
     PetscInfo(obj, msg, arg1);
     PetscInfo(obj, msg, arg1, arg2);
```

is evaluated as follows.
```none
    -info or -info :: prints `msg` to `PETSC_STDOUT`, for any PETSc `obj` regardless class or communicator
    -info :mat:self prints `msg` to `PETSC_STDOUT` only if class of `obj` is `Mat`, and its communicator has size = 1
    -info myInfoFileName:~vec:~self prints `msg` to file named `myInfoFileName`, only if the `obj`'s class is `NULL` or other than `Vec`, and `obj`'s communicator has size > 1
    -info :sys prints to `PETSC_STDOUT` only if `obj` is `NULL`
    -info :sys:~self deactivates all info messages because `sys` means `obj` = `NULL` which implies `PETSC_COMM_SELF` but `~self` filters out everything on `PETSC_COMM_SELF`.
```


## Fortran Note
This function does not take the `obj` argument, there is only the `PetscInfo()`
version, not `PetscInfo()` etc.


## See Also
 [](sec_PetscInfo), `PetscInfoAllow()`, `PetscInfoSetFromOptions()`, `PetscInfoEnabled()`, `PetscInfoSetFile()`, `PetscInfoGetFile()`, `PetscInfoSetClasses()`,
`PetscInfoGetClass()`, `PetscInfoGetInfo()`, `PetscInfoProcessClass()`, `PetscInfoSetFilterCommSelf()`, `PetscInfoDestroy()`, `PetscInfoDeactivateClass()`,
`PetscInfoActivateClass()`

## Level
intermediate

## Location
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/info/verboseinfo.c.html#PetscInfo">src/sys/info/verboseinfo.c</A>

## Examples
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/dm/impls/plex/tutorials/ex10.c.html">src/dm/impls/plex/tutorials/ex10.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex72.c.html">src/ksp/ksp/tutorials/ex72.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ksp/ksp/tutorials/ex73.c.html">src/ksp/ksp/tutorials/ex73.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/mat/tutorials/ex7.c.html">src/mat/tutorials/ex7.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/snes/tutorials/ex56.c.html">src/snes/tutorials/ex56.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/sys/tutorials/ex3f.F90.html">src/sys/tutorials/ex3f.F90</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex10.c.html">src/ts/tutorials/ex10.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/tutorials/ex11.c.html">src/ts/tutorials/ex11.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/utils/dmplexlandau/tutorials/ex1.c.html">src/ts/utils/dmplexlandau/tutorials/ex1.c</A><BR>
<A HREF="PETSC_DOC_OUT_ROOT_PLACEHOLDER/src/ts/utils/dmplexlandau/tutorials/ex2.c.html">src/ts/utils/dmplexlandau/tutorials/ex2.c</A><BR>


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


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