Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify rust & C++ logs using the Rust facilities. #92

Merged
merged 3 commits into from
Dec 15, 2023
Merged

Conversation

ceejbot
Copy link
Owner

@ceejbot ceejbot commented Dec 15, 2023

The choice was to write macros to replace the log crate macros, or
write templates to sink the C++ logging to Rust. I went with Rust
because what good is being in the evangelism task force if I don't
ruthlessly carcinicize?

Wrote the templates by contemplating what the SKSE peeps did to put
templates in front of spdlog. These templates are in front of fmt
instead. The guts of each implementation routes to shims in front of
the the log crate's macros.

The new namespace is rlog. All calls to logger::info() are now
calls to rlog::info() which eventually dispatches to log::info!().

The debug and trace level log templates add filename & line number
information to the start of each log message. Unfortunately those two
levels are decorated with fairly useless information from the rust
logger, which I can't rid of without also affecting rust-sourced log
lines. I'll need to find a new crate. This is, however, good enough
to ship.

Got rid of spdlog in the build. It remains in the deps because the
CommonLibSSE dll needs it.

Demoted some logs while I was looking at them in the unified context.
I will need to systematically review logging because it feels too
voluminous now that it's all in one file.

The choice was to write macros to replace the log crate macros, or
write templates to sink the C++ logging to Rust. I went with Rust
because what good is being in the evangelism task force if I don't
ruthlessly carcinicize?

Wrote the templates by contemplating what the SKSE peeps did to put
templates in front of `spdlog`. These templates are in front of `fmt`
instead. The guts of each implementation routes to shims in front of
the the `log` crate's macros.

The new namespace is `rlog`. All calls to `logger::info()` are now
calls to `rlog::info()` which eventually dispatches to `log::info!()`.

Demoted some logs while I was looking at them in the unified context.
I will need to systematically review logging because it feels too
voluminous now that it's all in one file.
The rust module information is entirely useless, but I
do not yet know how to conditionally get rid of it. This
is, however, good enough to ship.

Got rid of spdlog in the build.
@ceejbot ceejbot merged commit 3a92d1e into latest Dec 15, 2023
1 check failed
@ceejbot ceejbot deleted the ceej/unify-logging branch December 15, 2023 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant