[AD] Patch to change the logfile name (4.3.10) |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
I hope that this fits in neatly but someone else might have a suggestion
about how better to do it.
I wanted to change src/allegro.c so that it could output its allegro.log log
file to a place other than the current directory. My beta testers were
complaining (as beta testers do) about log files being left "laying
around."
So I added a #define in include/allegro/internal/aintern.h thus:
#define ALLEGRO_LOGFILE_NAME "allegro.log"
And changed src/allegro.c to use it. So if a platform wants to change the
log file name they can simply #undef and then re#define it in their
platform specific header file (the one defined by ALLEGRO_INTERNAL_HEADER
in the platform's *cfg.h file).
One thing though - I had to #include ALLEGRO_INTERNAL_HEADER in
src/allegro.c, as I have seen done in other files. I was just wondering
why this isn't included by default. I noticed that we have to #define
ALLEGRO_INTERNAL_HEADER and ALLEGRO_EXTRA_HEADER in our platform's *cfg.h
file and that ALLEGRO_EXTRA_HEADER is included at the end of
include/allegro.h. Is there a reason only one of these is included? Am I
missing their true purpose?
Hope the attachment makes some sense. :-)
--
/-------------------------------------------------------------------\
[Hitman/Code HQ - 6502/z80/68000/604e/80x86/ARM coder - Amiga rulez!]
[VZ-200/VIC-20/MZ-700/c16/c64*10/c128*8/Plus-4/CPC464/CD32/500*2 ]
[600/1000/1200*2/A4000/SNES/N64/Dreamcast/Athlon 1100/AmigaOne ]
[Assembly Language: The most fun you can have with your clothes on! ]
\-------------------------------------------------------------------/
Index: src/allegro.c
===================================================================
--- src/allegro.c (revision 11138)
+++ src/allegro.c (working copy)
@@ -23,6 +23,9 @@
#include "allegro.h"
#include "allegro/internal/aintern.h"
+#ifdef ALLEGRO_INTERNAL_HEADER
+ #include ALLEGRO_INTERNAL_HEADER
+#endif
#define PREFIX_I "al-main INFO: "
@@ -640,7 +643,7 @@
if (s)
trace_file = fopen(s, "w");
else
- trace_file = fopen("allegro.log", "w");
+ trace_file = fopen(ALLEGRO_LOGFILE_NAME, "w");
if (debug_assert_virgin)
_add_exit_func(debug_exit, "debug_exit");
Index: include/allegro/internal/aintern.h
===================================================================
--- include/allegro/internal/aintern.h (revision 11138)
+++ include/allegro/internal/aintern.h (working copy)
@@ -28,6 +28,10 @@
#endif
+/* name of the log file by which to write by default. This can be overridden by platform */
+/* specific header files if required */
+#define ALLEGRO_LOGFILE_NAME "allegro.log"
+
/* length in bytes of the cpu_vendor string */
#define _AL_CPU_VENDOR_SIZE 32