[wiki] [sites] Added logging patch || fami fish
commit f5618f1c4ad679952c078b4b8e4b7a15e19e41a1
Author: fami fish <19bors.steriann_AT_gmail.com>
Date: Mon Aug 14 22:51:36 2023 +0300
Added logging patch
diff --git a/dwm.suckless.org/patches/logging/dwm-logging-6.4-20230814-17c7c0a.diff b/dwm.suckless.org/patches/logging/dwm-logging-6.4-20230814-17c7c0a.diff
new file mode 100644
index 00000000..700b691d
--- /dev/null
+++ b/dwm.suckless.org/patches/logging/dwm-logging-6.4-20230814-17c7c0a.diff
_AT_@ -0,0 +1,80 @@
+From 17c7c0ae9713c782eb032a4be67a42311269059a Mon Sep 17 00:00:00 2001
+From: fami fish <19bors.steriann_AT_gmail.com>
+Date: Mon, 14 Aug 2023 22:23:51 +0300
+Subject: [PATCH] dwm-logging-6.4
+
+---
+ 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
new file mode 100644
index 00000000..0259cbe1
--- /dev/null
+++ b/dwm.suckless.org/patches/logging/index.md
_AT_@ -0,0 +1,16 @@
+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 Mon Aug 14 2023 - 21:53:15 CEST
This archive was generated by hypermail 2.3.0
: Mon Aug 14 2023 - 22:01:05 CEST