dept2 / CuteLogger

Logger: simple, convinient and thread safe logger for Qt-based C++ apps
GNU Lesser General Public License v2.1
147 stars 96 forks source link

Disable escaping #35

Closed arietto closed 4 years ago

arietto commented 4 years ago

Hello! I'd like to switch off escaping in my log. Is it possible? When I log JSON fragment via LOG_TRACE() to debug console, it contains ugly \" and \n elements. Is the problem linked with noquote?

cyberbobs commented 4 years ago

It sure is. By default, QDebug formats QString output enclosing it in quotes and escaping possibly unsafe characters (including the quotes, word wraps etc.). You can disable this just adding .noquote() to your LOG_TRACE call, which returns QDebug object just like qDebug macro does.

LOG_TRACE().noquote() << "JSON:" << yourJsonVariable;
arietto commented 4 years ago

Thank you, sir!