# HG changeset patch # User Mikael Berthe # Date 1122399202 -3600 # Node ID 2e6c7b1440d1bd25a85d01491548da102b96eb1a # Parent 00809e3e327eb14ac52b7171dbd3e9ab2eda8908 Improve debugging/logging * Tell the user when the tracelog file can't be open * Only include logprint.h when screen.h is not needed diff -r 00809e3e327e -r 2e6c7b1440d1 mcabber/src/histolog.c --- a/mcabber/src/histolog.c Tue Jul 26 18:18:30 2005 +0100 +++ b/mcabber/src/histolog.c Tue Jul 26 18:33:22 2005 +0100 @@ -30,8 +30,8 @@ #include "histolog.h" #include "hbuf.h" #include "jabglue.h" -#include "screen.h" #include "utils.h" +#include "logprint.h" static guint UseFileLogging; static guint FileLoadLogs; diff -r 00809e3e327e -r 2e6c7b1440d1 mcabber/src/hooks.c --- a/mcabber/src/hooks.c Tue Jul 26 18:18:30 2005 +0100 +++ b/mcabber/src/hooks.c Tue Jul 26 18:33:22 2005 +0100 @@ -21,9 +21,9 @@ #include #include -#include #include "hooks.h" +#include "screen.h" #include "roster.h" #include "histolog.h" #include "utf8.h" diff -r 00809e3e327e -r 2e6c7b1440d1 mcabber/src/settings.c --- a/mcabber/src/settings.c Tue Jul 26 18:18:30 2005 +0100 +++ b/mcabber/src/settings.c Tue Jul 26 18:33:22 2005 +0100 @@ -26,7 +26,7 @@ #include "settings.h" #include "commands.h" #include "utils.h" -#include "screen.h" +#include "logprint.h" static GSList *option; static GSList *alias; diff -r 00809e3e327e -r 2e6c7b1440d1 mcabber/src/utils.c --- a/mcabber/src/utils.c Tue Jul 26 18:18:30 2005 +0100 +++ b/mcabber/src/utils.c Tue Jul 26 18:33:22 2005 +0100 @@ -31,7 +31,7 @@ #include #include -#include "screen.h" +#include "logprint.h" static int DebugEnabled; static char *FName; @@ -63,7 +63,10 @@ DebugEnabled = level; fp = fopen(FName, "a"); - if (!fp) return; + if (!fp) { + fprintf(stderr, "ERROR: Cannot open tracelog file\n"); + return; + } fprintf(fp, "New trace log started.\n" "----------------------\n"); fchmod(fileno(fp), S_IRUSR|S_IWUSR); @@ -77,7 +80,10 @@ if (((DebugEnabled == 2) && (flag & (LPRINT_LOG|LPRINT_DEBUG))) || ((DebugEnabled == 1) && (flag & LPRINT_LOG))) { FILE *fp = fopen(FName, "a+"); - if (!fp) return; + if (!fp) { + scr_LogPrint(LPRINT_NORMAL, "ERROR: Cannot open tracelog file"); + return; + } fputs(data, fp); fclose(fp); }