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

fix dup_filter_sink lose source_loc #2549

Merged
merged 1 commit into from
Nov 22, 2022
Merged

Conversation

zydxhs
Copy link
Contributor

@zydxhs zydxhs commented Nov 22, 2022

Hi, dup_filter_sink lose the source_loc, when I use it like this:

auto dup_filter = std::make_shared<spdlog::sinks::dup_filter_sink_st>(std::chrono::seconds(5));
dup_filter->set_sinks(spdlog::default_logger()->sinks());
spdlog::default_logger()->sinks() = {std::move(dup_filter)};
spdlog::default_logger()->set_pattern("%Y-%m-%d %H:%M:%S.%e %^%l%$ %t [%s:%#:%!] %v");

for (int i = 0; i < 5; ++i) { SPDLOG_LOGGER_INFO(spdlog::default_logger_raw(), "duplicate log"); }
SPDLOG_LOGGER_INFO(spdlog::default_logger_raw(), "different log");

It's output has none filename/line/functionname but [::]:

2022-11-22 14:43:54.773 info 13089 [main.cpp:126:test] duplicate log
2022-11-22 14:43:54.773 info 13089 [::] Skipped 4 duplicate messages..
2022-11-22 14:43:54.773 info 13089 [main.cpp:127:test] different log

@gabime gabime merged commit 50e8b2d into gabime:v1.x Nov 22, 2022
@gabime
Copy link
Owner

gabime commented Nov 22, 2022

Thanks @zydxhs

@zydxhs zydxhs deleted the fix-lose-source_loc branch November 23, 2022 09:49
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.

2 participants