MONGOC_CLIENT_...TURED_LOG_OPTS(3)
π
mongoc_client_pool_set_structured_log_opts π
okay bestie, so this is a libmongoc manpage β section 3, the library-calls section β and it's all about making your client pool's structured logging behave the way you want it to. let's get into it π«Ά
β¨ SYNOPSIS β¨
bool
mongoc_client_pool_set_structured_log_opts (mongoc_client_pool_t *pool,
const mongoc_structured_log_opts_t *opts);
πΈ DESCRIPTION πΈ
so basically this call reconfigures your client pool's structured logging subsystem. that's the whole vibe. if you wanna know more, go read Structured Logging (iykyk).
the mongoc_structured_log_opts_t gets copied by the pool β like, the pool takes a lil photocopy and keeps it β so you can safely destroy your copy once this API call finishes. no cap, you're free. π¦
β οΈ but heads up: the application is responsible for making sure anyuser_datareferenced byoptsstays valid for the entire lifetime of the pool. the pool does not babysit that for you, bestie. keep it alive. π
by default, the mongoc_client_pool_t comes with log options captured from the environment during mongoc_client_pool_new(). wanna see the list of supported options? that lives in mongoc_structured_log_opts_new(). go peek. π
and if you ever wanna just⦠turn the whole structured logging subsystem off? you can do that:
- pass
NULLasopts, or - equivalently, pass
NULLas themongoc_structured_log_func_tinmongoc_structured_log_opts_set_handler().
either way, logging said bye. π
π PARAMETERS π
poolβ amongoc_client_pool_t. your pool. your girl. πoptsβ amongoc_structured_log_opts_tthat you allocated withmongoc_structured_log_opts_new(), orNULLif you're tryna disable structured logging entirely. β¨
β RETURNS β
returns true when you used it correctly. slay. π
but if you call it multiple times per pool, or after the first client is initialized? it returns false and logs a warning. not me getting caught doing that π β don't be that girl.
π§ THREAD SAFETY π§
okay this is the important one:
- this function can only be called once on a pool, and it must be called before the first call to
mongoc_client_pool_pop(). periodt. no second chances. π₯ - thread safety inside the handler? that's the application's responsibility, bestie β not the library's problem π
- handlers may be invoked concurrently by multiple pool users. so likeβ¦ expect the chaos. π
π SEE ALSO π
- Structured Logging
π AUTHOR π
MongoDB, Inc
π COPYRIGHT π
2009-present, MongoDB, Inc.
and that's the whole page, bestie β no notes. this was libmongoc version 2.5.6, dated Oct 09, and honestly it ate. go forth and log structured-ly ππβ¨
π¦ 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