---- - config.def.h | 3 +++ - dwm.c | 22 ++++++++++++++++++++++ - 2 files changed, 25 insertions(+) - -diff --git a/config.def.h b/config.def.h -index 9efa774..f86ab67 100644 ---- a/config.def.h -+++ b/config.def.h -_AT_@ -1,5 +1,8 @@ - /* See LICENSE file for copyright and license details. */ - -+/* logging & debugging */ -+static const unsigned int logfile = 1; /* 1 means enable logging to a file*/ -+ - /* appearance */ - static const unsigned int borderpx = 1; /* border pixel of windows */ - static const unsigned int snap = 32; /* snap pixel */ -diff --git a/dwm.c b/dwm.c -index f1d86b2..d0f6db7 100644 ---- a/dwm.c -+++ b/dwm.c -_AT_@ -25,6 +25,7 @@ - #include <signal.h> - #include <stdarg.h> - #include <stdio.h> -+#include <time.h> - #include <stdlib.h> - #include <string.h> - #include <unistd.h> -_AT_@ -222,6 +223,7 @@ static void updateclientlist(void); - static int updategeom(void); - static void updatenumlockmask(void); - static void updatesizehints(Client *c); -+static void logstr(char *c); - static void updatestatus(void); - static void updatetitle(Client *c); - static void updatewindowtype(Client *c); -_AT_@ -2001,6 +2003,24 @@ updatesizehints(Client *c) - c->isfixed = (c->maxw && c->maxh && c->maxw == c->minw && c->maxh == c->minh); - c->hintsvalid = 1; - } -+void -+logstr(char* c) { -+ FILE *f; -+ time_t now; -+ struct tm tm; -+ -+ f = fopen("dwm.log", "a+"); -+ setbuf(f, NULL); /* disables buffering */ -+ if (f == NULL) { -+ return; -+ } -+ -+ now = time(NULL); -+ tm = *localtime(&now); -+ -+ fprintf(f, "[%02d:%02d:%02d] %s", tm.tm_hour, tm.tm_min, tm.tm_sec, c); -+ return; -+} - - void - updatestatus(void) -_AT_@ -2143,6 +2163,8 @@ zoom(const Arg *arg) - int - main(int argc, char *argv[]) - { -+ logstr("DWM started"); -+ - if (argc == 2 && !strcmp("-v", argv[1])) - die("dwm-"VERSION); - else if (argc != 1) --- -2.41.0 - diff --git a/dwm.suckless.org/patches/logging/index.md b/dwm.suckless.org/patches/logging/index.md deleted file mode 100644 index 0259cbe1..00000000 --- a/dwm.suckless.org/patches/logging/index.md +++ /dev/null _AT_@ -1,16 +0,0 @@ -logging -======= - -Description ------------ -This patch implements a very basic file logging utility. It is designed for those -working on DWM source code. - - -Download --------- -* [dwm-logging-20230814-17c7c0a.diff](logging.diff) - -Authors -------- -* Fami fish - <19bors.steriann_AT_gmail.com>Received on Fri Aug 18 2023 - 18:20:09 CEST
This archive was generated by hypermail 2.3.0 : Fri Aug 18 2023 - 18:25:09 CEST