Skip to content

Commit

Permalink
OrcLib: Log: Logger: DumpBackTrace: set temporarly logger level to trace
Browse files Browse the repository at this point in the history
  • Loading branch information
fabienfl-orc committed Dec 1, 2020
1 parent 31d3457 commit ff0330c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/OrcLib/Log/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,10 @@ uint64_t Logger::criticalCount() const
// dedicated sink should be done so all logs would be automatically sorted.
void Logger::DumpBacktrace()
{
const auto& sinks = Get(Facility::kDefault)->sinks();
auto defaultLogger = Get(Facility::kDefault);
const auto initialLevel = defaultLogger->level();
defaultLogger->set_level(spdlog::level::trace);
const auto& sinks = defaultLogger->sinks();

std::vector<spdlog::level::level_enum> levels;
for (size_t i = 0; i < sinks.size(); ++i)
Expand All @@ -125,6 +128,8 @@ void Logger::DumpBacktrace()
{
sinks[i]->set_level(levels[i]);
}

defaultLogger->set_level(initialLevel);
}

void Logger::Set(Facility id, std::shared_ptr<spdlog::logger> logger)
Expand Down

0 comments on commit ff0330c

Please sign in to comment.