MONGOC_CLIENT...TURED_LOG_OPTS(3)
β¨ mongoc_client_set_structured_log_opts β¨
okay bestie so this is a page straight out of libmongoc and it's all about reconfiguring the structured logging on a single client. yes, we're talking logging. and honestly? it's giving main character energy. π
πΈ SYNOPSIS πΈ
bool
mongoc_client_set_structured_log_opts (mongoc_client_t *client,
const mongoc_structured_log_opts_t *opts);
π¦ DESCRIPTION π¦
So what does it actually do? It reconfigures this client's structured logging subsystem. That's it, that's the vibe. If you want the deep lore, go peek at Structured Logging. π
π important bestie: do NOT call this on clients that are part of amongoc_client_pool_t. Structured logging for pools has to be configured withmongoc_client_pool_set_structured_log_opts()before the first call tomongoc_client_pool_pop(). no cap, that's a hard rule.
The mongoc_structured_log_opts_t gets copied by the client, so you can safely destroy yours after this API call completes β she's got her own copy, she doesn't need yours anymore π«Ά. But heads up: you (the application) are responsible for making sure any user_data referenced by opts stays valid for the lifetime of the client. don't go freeing that stuff, okay? π
By default, the mongoc_client_t will have log options captured from the environment during mongoc_client_new(). for the full list of supported options, go look at mongoc_structured_log_opts_new(). iykyk π
And you can straight up disable the whole structured logging subsystem β just pass NULL as opts, or equivalently pass NULL as the mongoc_structured_log_func_t in mongoc_structured_log_opts_set_handler(). literally two ways to the same slay. β¨
π PARAMETERS π
- client β a
mongoc_client_t. the one and only β¨ - opts β a
mongoc_structured_log_opts_tallocated withmongoc_structured_log_opts_new(), orNULLto disable structured logging. pick your fighter π
β RETURNS β
Returns true when used correctly. π If you call it on a pooled client, it returns false and logs a warning β so like, read the room, bestie. π
π₯ SEE ALSO π₯
Structured Logging
π AUTHOR π
MongoDB, Inc
π COPYRIGHT π
2009-present, MongoDB, Inc.
and that's the whole page, bestie! π§ go forth and log responsibly. this masterpiece of documentation is from libmongoc version 2.5.6, dated Oct 09, 2026 β periodt. π
β¨
π¦ where this page comes from
- epel 10: mongo-c-driver-devel 2.5.6-1.el10_3 Β· Apache-2.0 AND ISC AND MIT AND Zlib
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms