Summary
The LogMetadata class controls whether metadata will be included when running geoprocessing tools.
Discussion
Metadata logging is activated by default. When using the LogMetadata class as a function decorator or in a with block as a context manager, the logging settings will only persist for the duration of the function or with block. To set metadata logging for an entire script, use the SetLogMetadata function.
Syntax
LogMetadata (log_metadata)
| Parameter | Explanation | Data Type |
log_metadata | Specifies whether the dataset metadata will be updated.
| Boolean |
Code sample
Use the LogMetadata class as a context manager.
import arcpy
gdb = r"d:\data\data.gdb"
with arcpy.LogMetadata(False):
arcpy.management.CreateFeatureclass(gdb, "Cities", "POINT")Use the LogMetadata class as a function decorator.
import arcpy
@arcpy.LogMetadata(False)
def myFunc(gdb, name):
arcpy.management.CreateFeatureclass(gdb, name, "POINT")
gdb = r"d:\data\data.gdb"
myFunc(gdb, "Cities")