debug: move to hyprutils' logger (#12673)
This commit is contained in:
parent
f88deb928a
commit
6175ecd4c4
147 changed files with 1696 additions and 1709 deletions
|
|
@ -1,8 +1,9 @@
|
|||
#include "FsUtils.hpp"
|
||||
#include "../../debug/Log.hpp"
|
||||
#include "../../debug/log/Logger.hpp"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
|
||||
#include <hyprutils/string/String.hpp>
|
||||
#include <hyprutils/string/VarList.hpp>
|
||||
|
|
@ -17,7 +18,7 @@ std::optional<std::string> NFsUtils::getDataHome() {
|
|||
const auto HOME = getenv("HOME");
|
||||
|
||||
if (!HOME) {
|
||||
Debug::log(ERR, "FsUtils::getDataHome: can't get data home: no $HOME or $XDG_DATA_HOME");
|
||||
Log::logger->log(Log::ERR, "FsUtils::getDataHome: can't get data home: no $HOME or $XDG_DATA_HOME");
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
|
@ -27,26 +28,26 @@ std::optional<std::string> NFsUtils::getDataHome() {
|
|||
|
||||
std::error_code ec;
|
||||
if (!std::filesystem::exists(dataRoot, ec) || ec) {
|
||||
Debug::log(ERR, "FsUtils::getDataHome: can't get data home: inaccessible / missing");
|
||||
Log::logger->log(Log::ERR, "FsUtils::getDataHome: can't get data home: inaccessible / missing");
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
dataRoot += "hyprland/";
|
||||
|
||||
if (!std::filesystem::exists(dataRoot, ec) || ec) {
|
||||
Debug::log(LOG, "FsUtils::getDataHome: no hyprland data home, creating.");
|
||||
Log::logger->log(Log::DEBUG, "FsUtils::getDataHome: no hyprland data home, creating.");
|
||||
std::filesystem::create_directory(dataRoot, ec);
|
||||
if (ec) {
|
||||
Debug::log(ERR, "FsUtils::getDataHome: can't create new data home for hyprland");
|
||||
Log::logger->log(Log::ERR, "FsUtils::getDataHome: can't create new data home for hyprland");
|
||||
return std::nullopt;
|
||||
}
|
||||
std::filesystem::permissions(dataRoot, std::filesystem::perms::owner_read | std::filesystem::perms::owner_write | std::filesystem::perms::owner_exec, ec);
|
||||
if (ec)
|
||||
Debug::log(WARN, "FsUtils::getDataHome: couldn't set perms on hyprland data store. Proceeding anyways.");
|
||||
Log::logger->log(Log::WARN, "FsUtils::getDataHome: couldn't set perms on hyprland data store. Proceeding anyways.");
|
||||
}
|
||||
|
||||
if (!std::filesystem::exists(dataRoot, ec) || ec) {
|
||||
Debug::log(ERR, "FsUtils::getDataHome: no hyprland data home, failed to create.");
|
||||
Log::logger->log(Log::ERR, "FsUtils::getDataHome: no hyprland data home, failed to create.");
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +70,7 @@ std::optional<std::string> NFsUtils::readFileAsString(const std::string& path) {
|
|||
bool NFsUtils::writeToFile(const std::string& path, const std::string& content) {
|
||||
std::ofstream of(path, std::ios::trunc);
|
||||
if (!of.good()) {
|
||||
Debug::log(ERR, "CVersionKeeperManager: couldn't open an ofstream for writing the version file.");
|
||||
Log::logger->log(Log::ERR, "CVersionKeeperManager: couldn't open an ofstream for writing the version file.");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue