fix: wome idiot mistakes in logger

This commit is contained in:
2025-08-07 21:13:18 +02:00
parent b5f0e15e5e
commit 89c4ec570d
2 changed files with 36 additions and 36 deletions
+28 -30
View File
@@ -1,31 +1,29 @@
{
"wallpaper": {
"paths": [
"~/Pictures/116327446_p0.jpg"
],
"dirs": [
"~/.config/backgrounds",
"/media/Beta/3-Anime/图集/绿色健康.2/绿色健康.2",
"/media/Beta/壁纸/库"
],
"excludes": [
"~/.config/backgrounds/nao-stars-crop-adjust-flop.jpg",
"~/.config/backgrounds/miku-gate.jpg",
"~/.config/backgrounds/README.md"
]
},
"actions": {
"confirm": "~/.scripts/change-wallpaper.fish \"%1\""
},
"style": {
"aspect_ratio": 1.6,
"image_width": 320,
"image_focus_width": 480,
"window_width": 750,
"window_height": 500
},
"sort": {
"type": "name",
"reverse": false
}
}
"wallpaper": {
"paths": [
"~/Pictures/116327446_p0.jpg"
],
"dirs": [
"~/.config/backgrounds"
],
"excludes": [
"~/.config/backgrounds/nao-stars-crop-adjust-flop.jpg",
"~/.config/backgrounds/miku-gate.jpg",
"~/.config/backgrounds/README.md"
]
},
"actions": {
"confirm": "~/.scripts/change-wallpaper.fish \"%1\""
},
"style": {
"aspect_ratio": 1.6,
"image_width": 320,
"image_focus_width": 480,
"window_width": 750,
"window_height": 500
},
"sort": {
"type": "name",
"reverse": false
}
}
+8 -6
View File
@@ -1,13 +1,14 @@
/*
* @Author: Uyanide pywang0608@foxmail.com
* @Date: 2025-08-07 01:12:37
* @LastEditTime: 2025-08-07 01:55:56
* @LastEditTime: 2025-08-07 21:11:22
* @Description: Implementation of logger.
*/
#include "logger.h"
#include <unistd.h>
#include <QCoreApplication>
#include <QObject>
#include <QProcessEnvironment>
#include <QString>
@@ -18,7 +19,6 @@
#define ENSURE_ENABLED return;
#else
#define ENSURE_ENABLED
static QTextStream s_logStream(stderr);
#endif
Logger* Logger::instance(FILE* stream) {
@@ -28,6 +28,8 @@ Logger* Logger::instance(FILE* stream) {
stream = stderr; // Default to stderr if no stream provided
}
logger = new Logger(stream);
// Ensure logger runs in the main thread
logger->moveToThread(QCoreApplication::instance()->thread());
}
return logger;
}
@@ -49,10 +51,10 @@ void Logger::_log(
const GeneralLogger::LogIndent indent) {
ENSURE_ENABLED
s_logStream << levelColorString << levelString << ' ';
for (qint32 i = 0; i < indent; i++) s_logStream << " ";
s_logStream << textColorString << msg << (textColorString.isEmpty() ? "\n" : "\033[0m\n");
s_logStream.flush();
m_logStream << levelColorString << levelString << ' ';
for (qint32 i = 0; i < indent; i++) m_logStream << " ";
m_logStream << textColorString << msg << (textColorString.isEmpty() ? "\n" : "\033[0m\n");
m_logStream.flush();
}
bool Logger::isColored() {