MONGOC_STRUCTURED_LOG_OPTS_NEW(3)
π MONGOC_STRUCTURED_LOG_OPTS_NEW(3) π
Hey bestie, welcome to the libmongoc page for this constructor-ish function. It's giving βmake me a fresh structured-log options objectβ and honestly it ate. π«Ά
β¨ SYNOPSIS β¨
mongoc_structured_log_opts_t *
mongoc_structured_log_opts_new (void);
π DESCRIPTION π
Okay so mongoc_structured_log_opts_new() creates a new mongoc_structured_log_opts_t, filled with defaults captured from the current environment. No cap. β¨
It also sets a default log handler which would write a text representation of each log message to stderr, stdout, or another file configurable using MONGODB_LOG_PATH. This setting has no effect if the default handler is replaced using mongoc_structured_log_opts_set_handler(). π
Environment variable errors are non-fatal, and result in one-time warnings delivered as an unstructured log. So like, the function keeps it moving even if an env var is messy. π«Ά
Per-component maximum levels are initialized equivalently to:
mongoc_structured_log_opts_set_max_level_for_all_components(opts, MONGOC_STRUCTURED_LOG_LEVEL_WARNING);
mongoc_structured_log_opts_set_max_levels_from_env(opts);
π ENVIRONMENT VARIABLES π
This is a full list of the captured environment variables. π
MONGODB_LOG_MAX_DOCUMENT_LENGTHβ Maximum length for JSON-serialized documents that appear within a log message. It may be a number, in bytes, orunlimited(case insensitive) to choose an implementation-specific value near the maximum representable length. By default, the limit is1000bytes. This limit affects interior documents like commands and replies, not the total length of a structured log message. πMONGODB_LOG_PATHβ A file path or one of the special stringsstderrorstdout(case insensitive) specifying the destination for structured logs seen by the default handler. By default, it writes tostderr. This path will be captured duringmongoc_structured_log_opts_new(), but it will not immediately be opened. If the file can't be opened, a warning is then written to the unstructured log and the handler writes structured logs tostderrinstead. π
WARNING: When a file path is given forMONGODB_LOG_PATH, each log instance (one stand-alone client or pool) will separately open this file for append. The results are operating system specific. On UNIX-like platforms each instance's output will be interleaved, in most cases without splitting individual log messages. Notably on Windows the file will be opened in exclusive mode by the first instance and subsequent instances will fail, falling back on the default ofstderr. Applications that use multiple processes or multiple client pools will likely want to supply a log handler that annotates each message with information about its originating log instance. π
MONGODB_LOG_COMMANDβ A log level name to set as the maximum forMONGOC_STRUCTURED_LOG_COMPONENT_COMMAND. πMONGODB_LOG_TOPOLOGYβ A log level name to set as the maximum forMONGOC_STRUCTURED_LOG_COMPONENT_TOPOLOGY. π¦MONGODB_LOG_SERVER_SELECTIONβ A log level name to set as the maximum forMONGOC_STRUCTURED_LOG_COMPONENT_SERVER_SELECTION. πΈMONGODB_LOG_CONNECTIONβ A log level name to set as the maximum forMONGOC_STRUCTURED_LOG_COMPONENT_CONNECTION. π₯MONGODB_LOG_ALLβ A log level name applied to all components not otherwise specified. π
Note that log level names are always case insensitive. This is a full list of recognized names, including allowed aliases:
emergency,offalertcriticalerrorwarning,warnnoticeinformational,infodebugtrace
π RETURNS π
A newly allocated mongoc_structured_log_opts_t. Slay. π«Ά
π AUTHOR π
MongoDB, Inc β iconic behavior, honestly. π
Β©οΈ COPYRIGHT Β©οΈ
2009-present, MongoDB, Inc. π
Signed with terminal love by your bestie: this page is from libmongoc 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