Init folly XLOG (async by default) and root categories at moqx.*#370
Draft
gmarzot wants to merge 2 commits into
Draft
Init folly XLOG (async by default) and root categories at moqx.*#370gmarzot wants to merge 2 commits into
gmarzot wants to merge 2 commits into
Conversation
Default config: root at INFO, AsyncFileWriter sink, sync_level=WARN so warnings/errors flush before a crash can lose them. Overridable at runtime via --logging=<config> or the FOLLY_LOGGING env var (folly::Init wires both into initLoggingOrDie). Replaces the placeholder TODO that claimed logging was "handled implicitly by folly::Init" — folly::Init only calls initLoggingOrDie with empty config, which yields the LoggerDB default (sync, INFO, stderr). Async-on-by-default is a stated perf goal for the moqx relay.
Rewrite __FILE__ for moqx sources at compile time so folly XLOG categories render as moqx.* (e.g. moqx.MoqxRelay) instead of src.* — moqx sources live under src/, but the user-facing logging API expects 'moqx' as the top-level category. -fmacro-prefix-map rewrites src/... -> moqx/... in __FILE__; xlog auto-derives the category from there. FOLLY_XLOG_STRIP_PREFIXES handles paths the prefix-map doesn't touch (notably generated headers under the build dir). Combined with the prior FOLLY_INIT_LOGGING_CONFIG commit, --logging moqx=DBG4 selects moqx-rooted categories and async-by-default keeps the relay off the log-I/O path.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two small consumer-side changes that complete the moqx half of the logging normalization:
src/main.cpp— declare a compile-time baseline logging config so async writes are on by default:Keeps the relay off the log-I/O path; `--logging=...` and the `FOLLY_LOGGING` env var still override at startup.
CMakeLists.txt— root XLOG categories at `moqx.` instead of `src.`:moqx sources live under `src/`, but the user-facing logging API expects `moqx` as the top-level category. The macro-prefix-map rewrites `FILE` so xlog auto-derives `moqx.MoqxRelay` etc. The strip-prefixes define covers paths the prefix-map doesn't touch (generated headers under the build dir).
Pairs with upstream moxygen-side work landing the same FOLLY_XLOG_STRIP_PREFIXES pattern there and converting moxygen sources to XLOG.
Test plan
This change is