Changeset 240 in pacpusframework for trunk/src/PacpusLib
- Timestamp:
- Dec 2, 2013, 9:06:33 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/PacpusLib/ColorSeverityFormatter.hpp
r239 r240 23 23 #include <boost/log/expressions.hpp> 24 24 #include <boost/log/utility/functional/bind.hpp> 25 #include <sstream> 25 26 26 27 // could use Boost.Predef with Boost >= 1.55 … … 138 139 /// @returns the ANSI color code for the given color. COLOR_DEFAULT is 139 140 /// an invalid input. 140 const char*getAnsiColorCode(Color color)141 std::string getAnsiColorCode(Color color) 141 142 { 142 143 const char* kEscapeSequence = "\033["; … … 166 167 ss << kPostfix; 167 168 168 return ss.str() .c_str();169 } 170 171 const char*getAnsiColorCodeRestoreDefault()169 return ss.str(); 170 } 171 172 std::string getAnsiColorCodeRestoreDefault() 172 173 { 173 174 return "\033[0m"; … … 179 180 void operator()(boost::log::basic_formatting_ostream<CharT>& strm, SeverityLevel const& sev) 180 181 { 181 strm << getAnsiColorCode(getColor(sev)) ;182 strm << getAnsiColorCode(getColor(sev)).c_str(); 182 183 } 183 184 }; … … 187 188 void operator()(boost::log::basic_formatting_ostream<CharT>& strm, SeverityLevel const& /*sev*/) 188 189 { 189 strm << getAnsiColorCodeRestoreDefault() ;190 strm << getAnsiColorCodeRestoreDefault().c_str(); 190 191 } 191 192 };
Note:
See TracChangeset
for help on using the changeset viewer.