summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeonardo Hernández Hernández <leohdz172@proton.me>2023-10-09 10:56:05 -0600
committerLeonardo Hernández Hernández <leohdz172@proton.me>2023-10-09 11:11:33 -0600
commit935b852dc5b7e042f3eaf446e69048631b8101be (patch)
tree585e4320c4582cb533b2625017d6c90c9373de7c
parenta18c52830010675cc794984c86db6c39776f914a (diff)
add [-d] flag to enable debug logging
-rw-r--r--config.def.h3
-rw-r--r--dwl.17
-rw-r--r--dwl.c8
3 files changed, 16 insertions, 2 deletions
diff --git a/config.def.h b/config.def.h
index 895284f..9365505 100644
--- a/config.def.h
+++ b/config.def.h
@@ -17,6 +17,9 @@ static const float fullscreen_bg[] = {0.1, 0.1, 0.1, 1.0}; /* You can al
#define TAGCOUNT (9)
static const int tagcount = TAGCOUNT;
+/* logging */
+static int log_level = WLR_ERROR;
+
static const Rule rules[] = {
/* app_id title tags mask isfloating monitor */
/* examples:
diff --git a/dwl.1 b/dwl.1
index 6f164e6..ce1acf9 100644
--- a/dwl.1
+++ b/dwl.1
@@ -7,6 +7,7 @@
.Sh SYNOPSIS
.Nm
.Op Fl v
+.Op Fl d
.Op Fl s Ar startup command
.Sh DESCRIPTION
.Nm
@@ -22,6 +23,12 @@ option,
writes its name and version to standard error and exits unsuccessfully.
.Pp
When given the
+.Fl d
+option,
+.Nm
+enables full wlroots logging, including debug information.
+.Pp
+When given the
.Fl s
option,
.Nm
diff --git a/dwl.c b/dwl.c
index 33b370c..7fe1559 100644
--- a/dwl.c
+++ b/dwl.c
@@ -2139,6 +2139,8 @@ setup(void)
for (i = 0; i < LENGTH(sig); i++)
sigaction(sig[i], &sa, NULL);
+ wlr_log_init(log_level, NULL);
+
/* The Wayland display is managed by libwayland. It handles accepting
* clients from the Unix socket, manging Wayland globals, and so on. */
dpy = wl_display_create();
@@ -2797,9 +2799,11 @@ main(int argc, char *argv[])
char *startup_cmd = NULL;
int c;
- while ((c = getopt(argc, argv, "s:hv")) != -1) {
+ while ((c = getopt(argc, argv, "s:hdv")) != -1) {
if (c == 's')
startup_cmd = optarg;
+ else if (c == 'd')
+ log_level = WLR_DEBUG;
else if (c == 'v')
die("dwl " VERSION);
else
@@ -2817,5 +2821,5 @@ main(int argc, char *argv[])
return EXIT_SUCCESS;
usage:
- die("Usage: %s [-v] [-s startup command]", argv[0]);
+ die("Usage: %s [-v] [-d] [-s startup command]", argv[0]);
}