IStructuredLogExtraFields

class omni.structuredlog.IStructuredLogExtraFields

Bases: _IStructuredLogExtraFields

Interface to manage extra CloudEvent fields to be included in each emitted message. This allows for fields to be added and removed as needed. It also allows existing registered fields to be enumerated at any given time. An extra field is a key/value pair that is included at the top level of the JSON object for each message that follows. Only string values are allowed for each key.

Methods

__init__(*args, **kwargs)

Overloaded function.

set_value(self, field_name, value, flags)

Adds, modifies, or removes an extra field key/value pair.

__init__(*args, **kwargs)

Overloaded function.

  1. __init__(self: omni.structuredlog._structuredlog.IStructuredLogExtraFields, arg0: omni.core._core.IObject) -> None

  2. __init__(self: omni.structuredlog._structuredlog.IStructuredLogExtraFields) -> None

set_value(self: omni.structuredlog._structuredlog.IStructuredLogExtraFields, field_name: str, value: str, flags: int) bool

Adds, modifies, or removes an extra field key/value pair.

@param[in] fieldName The name of the field to add, modify or remove. This may not be

``nullptr`` or and empty string. The field name must only contain alphabetic, numeric, or underscore ASCII characters. Any characters outside these will cause the field to not be updated. Further, this may not be one of the reserved CloudEvent field names such as “specversion”, “data”, “time”, “source”, “session”, “dataschema”, “type”, or “subject”.

@param[in] value The new value to set for the requested extra field. This may be

``nullptr`` to indicate that the named field should be removed. The value string may include any characters, but should be limited to a small number of characters (ideally less than 64 characters).

@param[in] flags Flags to control how the new value is added, modified, or removed.

Currently no flags are defined. This must be set to @ref omni::structuredlog::fExtraFieldFlagNone.

@returns ``true`` if the requested extra field is successfully added, modified, or removed.

Returns ``false`` if an invalid field name is given, or the operation could not be completed for any reason.

@remarks This adds, modifies, or removes a registered extra field and value. Any extra

fields that are registered at the time a message is emitted will be added to the message on output. At least for the first version of this interface it is expected that extra fields be largely static.

@thread_safety This call is thread safe.