From 089d8d4d9466b51caa8ab986fb0352ec2a8191e3 Mon Sep 17 00:00:00 2001 From: Jordan Bancino Date: Wed, 22 Mar 2023 18:29:05 +0000 Subject: [PATCH] Only install the memory hook if -v is given. This way, we can still set the debug level in the configuration, and not see the log just absolutely flooded with memory allocations and whatnot. This is helpful because I want debug messages to show up in development, but not in production, but having all the memory logging makes it almost impossible to pick anything else out of the log. I want the feature available, just not on by default because it's useful in limited circumstances. --- contrib/development.conf | 2 +- src/Main.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/contrib/development.conf b/contrib/development.conf index d293cd4..da6aa0b 100644 --- a/contrib/development.conf +++ b/contrib/development.conf @@ -7,7 +7,7 @@ "threads": 2, "log": { "output": "stdout", - "//level": "debug", + "level": "debug", "timestampFormat": "none", "color": true } diff --git a/src/Main.c b/src/Main.c index 6ede4be..cb06352 100644 --- a/src/Main.c +++ b/src/Main.c @@ -111,8 +111,6 @@ main(int argc, char **argv) return EXIT_FAILURE; } - MemoryHook(TelodendriaMemoryHook, NULL); - TelodendriaPrintHeader(); while ((opt = getopt(argc, argv, "f:Vvn")) != -1) @@ -142,6 +140,7 @@ main(int argc, char **argv) if (flags & ARG_VERBOSE) { LogConfigLevelSet(LogConfigGlobal(), LOG_DEBUG); + MemoryHook(TelodendriaMemoryHook, NULL); } if (flags & ARG_VERSION)