@@ -65,26 +65,27 @@ void StdOut::send(std::vector<Metric>&& metrics)
6565
6666void StdOut::send (const Metric& metric)
6767{
68- std::ostringstream mStream ;
69- mStream << " [" << mPrefix << " ] " << metric.getName ();
68+ std::ostringstream convert ;
69+ convert << " [" << mPrefix << " ] " << metric.getName ();
7070 for (auto & value : metric.getValues ()) {
7171 auto stringValue = std::visit (overloaded{
7272 [](const std::string& value) -> std::string { return value; },
7373 [](auto value) -> std::string { return std::to_string (value); }
7474 }, value.second );
7575 if (metric.getValuesSize () == 1 ) {
76- mStream << ' ,' << metric.getFirstValueType () << ' ' << stringValue;
76+ convert << ' ,' << metric.getFirstValueType () << ' ' << stringValue;
7777 } else {
78- mStream << ' ' << value.first << ' =' << stringValue;
78+ convert << ' ' << value.first << ' =' << stringValue;
7979 }
8080 }
81- mStream << ' ' << convertTimestamp (metric.getTimestamp ()) << ' ' << tagString;
81+ convert << ' ' << convertTimestamp (metric.getTimestamp ()) << ' ' << tagString;
8282
8383 for (const auto & [key, value] : metric.getTags ()) {
84- mStream << ' ,' << tags::TAG_KEY[key] << " =" << tags::GetValue (value);
84+ convert << ' ,' << tags::TAG_KEY[key] << " =" ;
85+ (value > 0 ) ? convert << tags::GetValue (value) : convert << (0 - value);
8586 }
86- mStream << ' \n ' ;
87- std::cout << mStream .str ();
87+ convert << ' \n ' ;
88+ std::cout << convert .str ();
8889}
8990
9091} // namespace backends
0 commit comments