GDAL

ograpispy.h File Reference

OGR C API spy. More...

`#include "gdal.h"`

Go to the source code of this file.

## Detailed Description

OGR C API spy.

If GDAL is compiled with OGRAPISPY_ENABLED defined (which is the case for a DEBUG build), a mechanism to trace calls to the OGR C API is available (calls to the C++ API will not be traced)

Provided there is compile-time support, the mechanism must also be enabled at runtime by setting the OGR_API_SPY_FILE configuration option to a file where the calls to the OGR C API will be dumped (stdout and stderr are recognized as special strings to name the standard output and error files). The traced calls are outputted as a OGR Python script.

Only calls that may have side-effects to the behavior of drivers are traced.

If a file-based datasource is open in update mode, a snapshot of its initial state is stored in a 'snapshot' directory, and then a copy of it is made as the working datasource. That way, the generated script can be executed in a reproducible way. The path for snapshots is the current working directory by default, and can be changed by setting the OGR_API_SPY_SNAPSHOT_PATH configuration option. If it is set to NO, the snapshot feature will be disabled. The reliability of snapshotting relies on if the dataset correctly implements GetFileList() (for multi-file datasources)