#[repr(transparent)]
pub struct LogField<'a>(_, _);
Expand description

Structure representing a single field in a structured log entry.

See g_log_structured for details. Log fields may contain UTF-8 strings, binary with embedded nul bytes, or arbitrary pointers.

Implementations

Creates a field from a borrowed key and value.

Creates a field with an empty value and data as a user data key. Fields created with this function are ignored by the default log writer. These fields are used to pass custom data into a writer function set with log_set_writer_func, where it can be retreived using Self::user_data.

The passed usize can be used by the log writer as a key into a static data structure. Thread locals are preferred since the log writer function will run in the same thread that invoked log_structured_array.

Retreives the field key.

Retrieves a byte array of the field value. Returns None if the field was created with Self::new_user_data.

Retrieves a string of the field value, or None if the string is not valid UTF-8. Also returns None if the field was created with Self::new_user_data.

Retrieves the the user data value from a field created with Self::new_user_data. Returns None if the field was created with Self::new.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.