MONGOC_STRUCTU...EVELS_FROM_ENV(3)
π MONGOC_STRUCTU...EVELS_FROM_ENV(3) β¨
okay so bestie, this is a libmongoc page β yes the title up top is literally truncated with ... in the middle, that's not me being messy, that's just how the header came through π we keep it, we love it, we move on.
π«Ά SYNOPSIS π«Ά
bool
mongoc_structured_log_opts_set_max_levels_from_env (mongoc_structured_log_opts_t *opts);
so what does it do? it sets any max log levels that the environment variables are asking for, in this exact order:
MONGODB_LOG_ALLβ this one's for all components, and it goes first π- then the per-component ones, in this order:
MONGODB_LOG_COMMAND,MONGODB_LOG_CONNECTION,MONGODB_LOG_TOPOLOGY, andMONGODB_LOG_SERVER_SELECTIONπ
it expects each value to be something mongoc_structured_log_get_named_level() actually recognizes β like, the value has to be a name it knows, no cap. if parsing goes wrong you might get a warning message, and that warning gets delivered via unstructured logging (yes, the old-school channel, iconic of it).
any component level that has no valid environment variable setting just gets left unmodified β no touching, no drama, it stays exactly how it was π
πΈ the automatic part (this is the tea) πΈ
this whole thing happens automatically when mongoc_structured_log_opts_new() establishes defaults. literally on its own, no extra call from you π«Ά
and then β any subsequent programmatic modifications you make to the mongoc_structured_log_opts_t will override the environment variable settings. so like, env vars set the vibe first, then you come in and change it. you win. periodt π
but bestie, what if you want the opposite?? what if you want the environment variables to override your programmatic settings instead? valid. main character energy. in that case, call mongoc_structured_log_opts_set_max_levels_from_env() after you call mongoc_structured_log_opts_set_max_level_for_component() and mongoc_structured_log_opts_set_max_level_for_all_components(). that processes the environment a second time π₯ which lets it override your customized defaults. slay.
β RETURNS β
- returns
trueon success β¨ - if warnings are encountered in the environment, it returns
falseand may log additional information to the unstructured logging facility π
β οΈ note that, by design, these errors are by default non-fatal. so like, don't panic. but also know that whenmongoc_structured_log_opts_new()internally calls this function, it ignores the return value entirely π β so afalsein that path lowkey goes nowhere.
π SEE ALSO π
- Structured Logging
π¦ AUTHOR π¦
MongoDB, Inc
π COPYRIGHT π
2009-present, MongoDB, Inc.
and that's the page, bestie π version 2.5.6, dated Oct 09, 202 β yeah the year got ate by the header on the way out, she's giving truncated, we still stan; anyway, MongoDB, Inc. wrote this and holds the copyright from 2009 to present, libmongoc forever π π«Ά
π¦ 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