MONGOC_STRUCTURED_LOG_FUNC_T(3)

✨ MONGOC_STRUCTURED_LOG_FUNC_T(3) ✨

okay bestie so this one's from libmongoc and it's literally just a typedef for a callback πŸ’… it's short, it's sweet, and it's the glue that makes structured logging pop off πŸŽ€


🌸 SYNOPSIS 🌸

typedef void (*mongoc_structured_log_func_t)
(const mongoc_structured_log_entry_t *entry, void *user_data);

So this is the callback function you hand over to mongoc_structured_log_opts_set_handler() β€” like, that's its whole job, that's its moment πŸ‘‘ it gets called, it does the thing, it exits, main character energy fr ✨

⚠️ tea time, and this part matters: structured log handlers must be thread-safe if they're gonna be used with mongoc_client_pool_t 😭 no exceptions, no "but it worked on my machine", please.
🫢 and also: handlers must avoid unbounded recursion β€” preferably by avoiding the use of any libmongoc client or pool which uses the same handler. like, don't call yourself through the thing that calls you, that's a spiral and nobody's got time for that πŸ’€

πŸ¦‹ PARAMETERS πŸ¦‹

  • entry β€” a mongoc_structured_log_entry_t pointer, and here's the catch 🌸 it's only valid during the handler invocation. so if you're thinking about stashing it somewhere for later... no bestie, don't, it's a now-thing, not a forever-thing πŸ™ˆ
  • user_data β€” optional user data, and it comes straight from mongoc_structured_log_opts_set_handler() πŸ’– your little payload, your little gift, passed right back to you πŸŽ€

πŸ’œ SEE ALSO πŸ’œ

  • Structured Logging β€” go read it, iykyk πŸ“–βœ¨

🌈 AUTHOR 🌈

MongoDB, Inc β€” yeah, them πŸ’… iconic behavior tbh

2009-present, MongoDB, Inc. β€” no cap, that's the line, copy it exactly if you need it 🫢


and that's the whole page, bestie 🧚 it's giving "small file, big responsibility" ngl πŸ”₯

signing off from libmongoc version 2.5.6, dated Oct 09, 2026 β€” mwah, slay, periodt πŸ’‹πŸ’–

πŸ“¦ where this page comes from