Skip to content

Commit

Permalink
fix: prefix may be a string_view
Browse files Browse the repository at this point in the history
  • Loading branch information
c-dilks committed Mar 25, 2024
1 parent 262f5d9 commit ff00b95
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/iguana/services/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ namespace iguana {
{
if(lev >= m_level) {
if(auto it{m_level_names.find(lev)}; it != m_level_names.end()) {
std::string prefix;
std::function<std::string(std::string)> style = [](std::string s)
{ return fmt::format("[{}]", s); };
if(m_enable_style) {
Expand All @@ -116,10 +115,10 @@ namespace iguana {
{ return fmt::format("[{}]", fmt::styled(s, fmt::emphasis::bold)); };
}
}
prefix = fmt::format("{} {} ", style(it->second), style(m_name));
std::string_view prefix = fmt::format("{} {} ", style(it->second), style(m_name));
fmt::print(
lev >= warn ? stderr : stdout,
fmt::runtime(prefix + message.data() + "\n"),
fmt::runtime(prefix + message + "\n"),
vals...);
}
else {
Expand Down

0 comments on commit ff00b95

Please sign in to comment.