How to write logs in one log file when functions are in different modules #63
Unanswered
MrCoco5921
asked this question in
Q&A
Replies: 1 comment 7 replies
-
You can call |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
in spdlog/examples/07_async_pool_sink.rs, firstly, we must construct a logger, that is Arc type. Then we use
info!(logger: logger, "hello async_pool_sink");
to write this sentence "hello async_pool_sink" into the specific log file. However, I notice that there must be a logger param.my code is like this:
there are two functions foo and test needing to output log, but I don't want to send logger parameter to these functions.
So I want to ask if there is any solution to realize this:
fn foo() { info!(logger:logger, "foo"); }
or
fn foo() { info!("foo"); }
and the logs output into the same log file.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions