MONGOC_STRUCTU...TS_SET_HANDLER(3)

🫢 MONGOC_STRUCTU...TS_SET_HANDLER(3) 🫢

okay bestie, this page is from the libmongoc manual and it's all about installing your very own structured-log handler. no cap, it's giving "plug in your callback and let it cook" energy. ✨

✨ SYNOPSIS ✨

void
mongoc_structured_log_opts_set_handler (mongoc_structured_log_opts_t *opts,
                                        mongoc_structured_log_func_t log_func,
                                        void *user_data);

okay so this function sets the function to be called to handle structured log messages, as a mongoc_structured_log_func_t. that's the whole vibe. πŸ’…

the callback gets a mongoc_structured_log_entry_t as a handle for obtaining additional information about the log message. important: this entry pointer is only valid during a callback, because it's a low cost reference to temporary data. do not be out here storing it, bestie. 😭

structured log handlers must be thread-safe if they will be used with mongoc_client_pool_t. also, handlers must avoid unbounded recursion, preferably by avoiding the use of any libmongoc client or pool which uses the same handler. yes, that's the warning label. 🫢

this function always replaces the default log handler from mongoc_structured_log_opts_new(), if it was still set. and if log_func is set to NULL, structured logging will be disabled. periodt. πŸ’€

πŸŽ€ PARAMETERS πŸŽ€

  • opts β€” Structured log options, allocated with mongoc_structured_log_opts_new().
  • log_func β€” The handler to install, a mongoc_structured_log_func_t, or NULL to disable structured logging.
  • user_data β€” Optional user data, passed on to the handler.

πŸ¦‹ SEE ALSO πŸ¦‹

  • Structured Logging

πŸ’… AUTHOR πŸ’…

MongoDB, Inc

2009-present, MongoDB, Inc.


bye bestie πŸ’– this footer is giving version 2.5.6, dated Oct 09, 202 β€” xoxo, the manual page πŸŽ€

πŸ“¦ where this page comes from