---
name: "mongoc_structured_log_entry_t"
section: "3"
platform: "linux"
package: "libmongoc-doc"
version: "1.30.4-1+deb13u3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/mongoc_structured_log_entry_t"
---

# mongoc\_structured\_log\_entry\_t(3)

## SYNOPSIS

```
typedef struct mongoc_structured_log_entry_t mongoc_structured_log_entry_t;
```

**mongoc\_structured\_log\_entry\_t** is an opaque structure which represents the temporary state of an in-progress log entry. It can only be used during a *mongoc\_structured\_log\_func\_t*, it is not valid after the log handler returns. Use the functions below to query individual aspects of the log entry.

## FUNCTIONS

### mongoc\_structured\_log\_entry\_get\_component()

### Synopsis

```
mongoc_structured_log_component_t
mongoc_structured_log_entry_get_component (const mongoc_structured_log_entry_t *entry);
```

### Parameters

- •

  **entry**: A *mongoc\_structured\_log\_entry\_t* pointer.

### Returns

The *mongoc\_structured\_log\_component\_t* associated with this log entry.

**SEE ALSO:**

```
Structured Logging
```

### mongoc\_structured\_log\_entry\_get\_level()

### Synopsis

```
mongoc_structured_log_level_t
mongoc_structured_log_entry_get_level (const mongoc_structured_log_entry_t *entry);
```

### Parameters

- •

  **entry**: A *mongoc\_structured\_log\_entry\_t* pointer.

### Returns

The *mongoc\_structured\_log\_level\_t* associated with this log entry.

**SEE ALSO:**

```
Structured Logging
```

### mongoc\_structured\_log\_entry\_get\_message\_string()

### Synopsis

```
const char *
mongoc_structured_log_entry_get_message_string (const mongoc_structured_log_entry_t *entry);
```

### Parameters

- •

  **entry**: A *mongoc\_structured\_log\_entry\_t* pointer.

### Returns

A string, guaranteed to be valid only during the lifetime of the structured log handler. It should not be freed or modified.

Identical to the value of the **message** key in the document returned by *mongoc\_structured\_log\_entry\_message\_as\_bson()*.

This is not a complete string representation of the structured log, but rather a standardized identifier for a particular log event.

**SEE ALSO:**

```
Structured Logging
```

### mongoc\_structured\_log\_entry\_message\_as\_bson()

### Synopsis

```
bson_t *
mongoc_structured_log_entry_message_as_bson (const mongoc_structured_log_entry_t *entry);
```

Make a new copy, as a *bson\_t*, of the log entry's standardized BSON representation. When possible, a log handler should avoid serializing log messages that will be discarded. Each call allocates an independent copy of the message that must be freed.

### Parameters

- •

  **entry**: A *mongoc\_structured\_log\_entry\_t* pointer.

### Returns

A new allocated *bson\_t* that must be freed with a call to *bson\_destroy()*.

**SEE ALSO:**

```
Structured Logging
```

**SEE ALSO:**

```
Structured Logging
```

## AUTHOR

MongoDB, Inc

## COPYRIGHT

2009-present, MongoDB, Inc.
