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) { ...@@ -104,8 +104,13 @@ void Log::log(Level level, const std::string& msg) {
while (start < text.size()) { while (start < text.size()) {
std::size_t lineWidth = 0; std::size_t lineWidth = 0;
std::size_t current = start; std::size_t current = start;
bool inPath = false;
while (current < text.size() && lineWidth < width) { while (current < text.size() && (lineWidth < width || inPath)) {
if (inPath){
if (text[current] == ' ' || text[current] == '\n'){
inPath = false;
}
}
if (text[current] == '\033') { if (text[current] == '\033') {
// Found ANSI escape sequence, skip until 'm' // Found ANSI escape sequence, skip until 'm'
std::size_t ansiEnd = text.find('m', current); std::size_t ansiEnd = text.find('m', current);
...@@ -121,6 +126,9 @@ void Log::log(Level level, const std::string& msg) { ...@@ -121,6 +126,9 @@ void Log::log(Level level, const std::string& msg) {
// Handle explicit line break // Handle explicit line break
break; break;
} else { } else {
if(!inPath && (text[current] == '/' || text[current] == '\\')) {
inPath = true;
}
// Normal character, increase line width // Normal character, increase line width
++lineWidth; ++lineWidth;
++current; ++current;
...@@ -164,7 +172,7 @@ void Log::log(Level level, const std::string& msg) { ...@@ -164,7 +172,7 @@ void Log::log(Level level, const std::string& msg) {
// Get the string representation of the log level // Get the string representation of the log level
const auto levelStr = EnumStrings<Level>::data[static_cast<std::size_t>(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 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()) { if (level >= getConsoleLevel()) {
for (const auto& context : mContext) { 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