Skip to content
Snippets Groups Projects
Commit 3d683ffb authored by Andre Sailer's avatar Andre Sailer
Browse files

MessageSvcSink: use fmt::runtime

parent 5bbe9155
No related branches found
No related tags found
1 merge request!1455C++20 fixes
......@@ -105,18 +105,20 @@ public:
assert( entry != registry.end() );
// print the json string according to format found
// This actually will call this formatter again a number of times
return fmt::format_to( ctx.out(), entry->second, json_arg );
return fmt::format_to( ctx.out(), fmt::runtime( entry->second ), json_arg );
} else {
// dealing with a {:name|fmt} format
auto actualFormat = fmt::format( "{{:{}", currentFormat ) + "}";
auto actualFormat = fmt::format( "{{:{}", fmt::runtime( currentFormat ) ) + "}";
switch ( currentFormat.back() ) {
case 'd':
return fmt::format_to( ctx.out(), actualFormat, j.at( currentName ).template get<unsigned int>() );
return fmt::format_to( ctx.out(), fmt::runtime( actualFormat ),
j.at( currentName ).template get<unsigned int>() );
case 'g':
return fmt::format_to( ctx.out(), actualFormat, j.at( currentName ).template get<double>() );
return fmt::format_to( ctx.out(), fmt::runtime( actualFormat ), j.at( currentName ).template get<double>() );
case 'p':
actualFormat[actualFormat.size() - 2] = 'g';
return fmt::format_to( ctx.out(), actualFormat, j.at( currentName ).template get<double>() * 100 );
return fmt::format_to( ctx.out(), fmt::runtime( actualFormat ),
j.at( currentName ).template get<double>() * 100 );
default:
return fmt::format_to( ctx.out(), "Unknown counter format : {}", currentFormat );
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment