aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorvaxerski <[email protected]>2022-06-03 17:48:07 +0200
committervaxerski <[email protected]>2022-06-03 17:48:07 +0200
commit9486a230c74e8873621fdf64a33adaaa660762e3 (patch)
tree0f0ee90736428b6b1bed1198e3e3db9be07c0dc3
parent6f3b004199a6b1bb0a8f5431d677ab926bdf19f3 (diff)
downloadHyprland-9486a230c74e8873621fdf64a33adaaa660762e3.tar.gz
Hyprland-9486a230c74e8873621fdf64a33adaaa660762e3.zip
Log to the instance folder
-rw-r--r--src/Compositor.cpp2
-rw-r--r--src/debug/Log.cpp7
-rw-r--r--src/debug/Log.hpp2
-rw-r--r--src/main.cpp11
4 files changed, 12 insertions, 10 deletions
diff --git a/src/Compositor.cpp b/src/Compositor.cpp
index c9a89603..f53d0272 100644
--- a/src/Compositor.cpp
+++ b/src/Compositor.cpp
@@ -3,6 +3,8 @@
CCompositor::CCompositor() {
m_szInstanceSignature = GIT_COMMIT_HASH + std::string("_") + std::to_string(time(NULL));
+ Debug::init(m_szInstanceSignature);
+
Debug::log(LOG, "Instance Signature: %s", m_szInstanceSignature.c_str());
setenv("HYPRLAND_INSTANCE_SIGNATURE", m_szInstanceSignature.c_str(), true);
diff --git a/src/debug/Log.cpp b/src/debug/Log.cpp
index b3d13583..559e7b79 100644
--- a/src/debug/Log.cpp
+++ b/src/debug/Log.cpp
@@ -1,14 +1,15 @@
#include "Log.hpp"
#include "../defines.hpp"
+#include "../Compositor.hpp"
#include <fstream>
#include <iostream>
-void Debug::init() {
+void Debug::init(std::string IS) {
if (ISDEBUG)
- logFile = "/tmp/hypr/hyprlandd-" + std::to_string(time(NULL)) + ".log";
+ logFile = "/tmp/hypr/" + IS + "/hyprlandd.log";
else
- logFile = "/tmp/hypr/hyprland-" + std::to_string(time(NULL)) + ".log";
+ logFile = "/tmp/hypr/" + IS + "/hyprland.log";
}
void Debug::log(LogLevel level, const char* fmt, ...) {
diff --git a/src/debug/Log.hpp b/src/debug/Log.hpp
index d5aa6958..2a7ab425 100644
--- a/src/debug/Log.hpp
+++ b/src/debug/Log.hpp
@@ -12,7 +12,7 @@ enum LogLevel {
};
namespace Debug {
- void init();
+ void init(std::string IS);
void log(LogLevel level, const char* fmt, ...);
inline std::string logFile;
diff --git a/src/main.cpp b/src/main.cpp
index a6f2469c..a437430f 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -3,6 +3,7 @@
#include "Compositor.hpp"
#include "config/ConfigManager.hpp"
#include "init/initHelpers.hpp"
+#include <iostream>
// I am a bad bad boy and have used some global vars here,
// just for this file
@@ -21,19 +22,17 @@ int main(int argc, char** argv) {
system("mkdir -p /tmp/hypr");
- Debug::init();
-
if (!ignoreSudo) {
if (Init::isSudo()) {
- Debug::log(CRIT, "Hyprland shall not be run as the root user. If you really want to, use the --i-am-really-stupid flag.");
- return 1;
+ std::cout << "Hyprland shall not be run as the root user. If you really want to, use the --i-am-really-stupid flag.\n";
+ return 1;
}
} else {
- Debug::log(WARN, "Running with ignored root checks, I surely hope you know what you're doing.");
+ std::cout << "Running with ignored root checks, I surely hope you know what you're doing.\n";
sleep(1);
}
- Debug::log(LOG, "Welcome to Hyprland!");
+ std::cout << "Welcome to Hyprland!\n";
// let's init the compositor.
// it initializes basic Wayland stuff in the constructor.