Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 22ebeab1 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

LOG: Get ride of the ../ in file with the logs

parent fcc86722
Branches
Étiquettes
1 requête de fusion!21Add clean logs support + dependent MR
Ce commit fait partie de la requête de fusion !21. Les commentaires créés ici seront créés dans le contexte de cette requête de fusion.
...@@ -24,6 +24,7 @@ set(STL_INC ...@@ -24,6 +24,7 @@ set(STL_INC
<ctype.h> <ctype.h>
<mutex> <mutex>
<iomanip> <iomanip>
<filesystem>
) )
set(EXT_INC PRIVATE set(EXT_INC PRIVATE
......
...@@ -29,6 +29,12 @@ StderrLogSinkDispatcher::trunkFileName(const char *fileName) noexcept ...@@ -29,6 +29,12 @@ StderrLogSinkDispatcher::trunkFileName(const char *fileName) noexcept
fileNameView.data() + fileNameView.size() }; fileNameView.data() + fileNameView.size() };
} }
std::string
StderrLogSinkDispatcher::reduceFileName(const std::string_view fileName) noexcept
{
return std::filesystem::path(fileName).lexically_normal();
}
StderrLogSinkDispatcher::StderrLogSinkDispatcher() noexcept StderrLogSinkDispatcher::StderrLogSinkDispatcher() noexcept
: LogSinkDispatcher(std::string_view{ "stderr" }) : LogSinkDispatcher(std::string_view{ "stderr" })
{ {
...@@ -38,7 +44,7 @@ void ...@@ -38,7 +44,7 @@ void
StderrLogSinkDispatcher::handleLogMessage(const std::string_view category, StderrLogSinkDispatcher::handleLogMessage(const std::string_view category,
const LogMessage &msg) noexcept const LogMessage &msg) noexcept
{ {
std::cerr << "#(" << trunkFileName(msg.getHeader().fileName) << " +" std::cerr << "#(" << reduceFileName(trunkFileName(msg.getHeader().fileName)) << " +"
<< msg.getHeader().lineNumberInFile << " | " << msg.getHeader().lineNumberInFile << " | "
<< LogLevel::toStdStringView(msg.getHeader().severity) << " -> " << category << ") " << LogLevel::toStdStringView(msg.getHeader().severity) << " -> " << category << ") "
<< msg.getTextBuffer() << '\n'; << msg.getTextBuffer() << '\n';
......
...@@ -115,6 +115,7 @@ class StderrLogSinkDispatcher : public LogSinkDispatcher { ...@@ -115,6 +115,7 @@ class StderrLogSinkDispatcher : public LogSinkDispatcher {
VIVY_UNMOVABLE_OBJECT(StderrLogSinkDispatcher) VIVY_UNMOVABLE_OBJECT(StderrLogSinkDispatcher)
static const std::string_view trunkFileName(const char *) noexcept; static const std::string_view trunkFileName(const char *) noexcept;
static std::string reduceFileName(const std::string_view) noexcept;
public: public:
explicit StderrLogSinkDispatcher() noexcept; explicit StderrLogSinkDispatcher() noexcept;
......
...@@ -7,12 +7,11 @@ ModuleDeclaration::resolvModules(LuaContext *const context) noexcept ...@@ -7,12 +7,11 @@ ModuleDeclaration::resolvModules(LuaContext *const context) noexcept
{ {
for (const auto &str : importNames) { for (const auto &str : importNames) {
const ModuleDeclaration *const mod = context->getModule(str); const ModuleDeclaration *const mod = context->getModule(str);
if (mod) { if (mod)
importedModules.emplace_back(mod); importedModules.emplace_back(mod);
} else {
else
context->failedWith("Failed to find needed module: " + str); context->failedWith("Failed to find needed module: " + str);
return false;
}
} }
return true; return true;
} }
......
...@@ -111,7 +111,7 @@ VivyApplication::getApplicationFont(Font id) const noexcept ...@@ -111,7 +111,7 @@ VivyApplication::getApplicationFont(Font id) const noexcept
} }
// Let the program crash // Let the program crash
qFatal("UNREACHABLE"); logFatal() << "Unreachable";
} }
MainWindow * MainWindow *
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter