aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlessandro Iezzi <aiezzi@alessandroiezzi.it>2023-05-17 17:35:09 +0200
committerAlessandro Iezzi <aiezzi@alessandroiezzi.it>2023-05-17 17:35:09 +0200
commit0df920a66fc34c2e84134f09d1415066fb4ee712 (patch)
tree7209865993f4b9e532176d0b0f5947e34cb9f1d5 /src
parent014a8aacd1e30bd5d13ba676065438ba8d3fbf1e (diff)
downloadcherry-0df920a66fc34c2e84134f09d1415066fb4ee712.tar.gz
cherry-0df920a66fc34c2e84134f09d1415066fb4ee712.zip
Replace printf with logs
Diffstat (limited to 'src')
-rw-r--r--src/application.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/application.c b/src/application.c
index 24ac7ba..fd99780 100644
--- a/src/application.c
+++ b/src/application.c
@@ -1,9 +1,11 @@
/* See LICENSE file for copyright and license details. */
+#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xlib.h>
#include <utils.h>
+#include <log.h>
#include "application.h"
#include "event.h"
#include "window.h"
@@ -82,9 +84,21 @@ cherry_application_main_loop(CherryApplication *app)
}
}
+static void
+print_log(Log *log, char *fmt, char *attr)
+{
+ char *message = calloc(strlen(fmt) + strlen(attr) + 1, sizeof(char));
+ sprintf(message, fmt, attr);
+ log_debug(log, message);
+
+ free(message);
+}
+
int
cherry_application_run(CherryApplication *app, int argc, char **argv)
{
+ Log *log = log_create("cherry_application_run");
+
if (app == NULL) exit(1);
/* setup display/screen */
@@ -104,7 +118,7 @@ cherry_application_run(CherryApplication *app, int argc, char **argv)
CherryWindow *w = clist_iterator_next(&it);
char *wnd_name = cherry_window_get_title(w);
- printf("Destroying window: %s\n", wnd_name);
+ print_log(log, "Destroying window: %s", wnd_name);
XFree(wnd_name);
XFreeGC(app->display, w->gc);