Skip to content
Snippets Groups Projects
Commit f887893a authored by Cyril Moineau's avatar Cyril Moineau Committed by Maxence Naud
Browse files

Fix #232

parent 4e75c3ea
No related branches found
No related tags found
2 merge requests!329[Fix] Log no wrap for Path,!325[Upd] Patch v0.5.1
Pipeline #65188 passed
......@@ -104,8 +104,13 @@ void Log::log(Level level, const std::string& msg) {
while (start < text.size()) {
std::size_t lineWidth = 0;
std::size_t current = start;
while (current < text.size() && lineWidth < width) {
bool inPath = false;
while (current < text.size() && (lineWidth < width || inPath)) {
if (inPath){
if (text[current] == ' ' || text[current] == '\n'){
inPath = false;
}
}
if (text[current] == '\033') {
// Found ANSI escape sequence, skip until 'm'
std::size_t ansiEnd = text.find('m', current);
......@@ -121,6 +126,9 @@ void Log::log(Level level, const std::string& msg) {
// Handle explicit line break
break;
} else {
if(!inPath && (text[current] == '/' || text[current] == '\\')) {
inPath = true;
}
// Normal character, increase line width
++lineWidth;
++current;
......@@ -164,7 +172,7 @@ void Log::log(Level level, const std::string& msg) {
// Get the string representation of the log level
const auto levelStr = EnumStrings<Level>::data[static_cast<std::size_t>(level)];
const std::size_t levelIndentSizes[6] = {10, 9, 11, 12, 10, 10};
const std::size_t width = 80 - levelIndentSizes[static_cast<std::size_t>(level)];
const std::size_t width = 100 - levelIndentSizes[static_cast<std::size_t>(level)];
if (level >= getConsoleLevel()) {
for (const auto& context : mContext) {
......
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