On Fri, Feb 22, 2002 at 08:15:57PM -0800, rob tavares wrote:
>> > How can I repair this?
>
With the plethora of people who can't seem to wrap their minds around
grep'ing a file for where there's an error, here's an idea that should
stop these problems from showing up all the time...
If you get some errors, just recompile the mud with -DDEBUG_LOG in the
makefile; added to MYFLAGS at line 12 of the Makefile after -Wall
(so it would be like this:
MYFLAGS = -Wall -DDEBUG_LOG
It'll show you the file, function, and even the line number of every
single time log() is called.
For how to apply it, I refer you to section 2.7 of the FAQ that came
with the source.
Untested patch vs stock bpl20
---- 8< cut here >8 ----
--- utils.h Thu Jan 10 10:44:56 2002
+++ utils.h.new Sat Feb 23 09:54:59 2002
@@ -14,7 +14,11 @@
extern struct weather_data weather_info;
extern FILE *logfile;
-#define log basic_mud_log
+#ifdef DEBUG_LOG
+#define log(fmt, args...) basic_mud_log(__FILE__, __FUNCTION__, __LINE__, fmt, args)
+#else
+#define log basic_mud_log
+#endif
/* public functions in utils.c */
char *str_dup(const char *source);
--- utils.c Sun Jan 13 15:07:28 2002
+++ utils.c.new Sat Feb 23 09:56:55 2002
@@ -175,7 +175,11 @@ void log_death_trap(struct char_data *ch
* New variable argument log() function. Works the same as the old for
* previously written code but is very nice for new code.
*/
+#ifdef DEBUG_LOG
+void basic_mud_log(const char *file, const char *function, const int line, const char *format, ...)
+#else
void basic_mud_log(const char *format, ...)
+#endif
{
va_list args;
time_t ct = time(0);
@@ -191,7 +195,11 @@ void basic_mud_log(const char *format, .
time_s[strlen(time_s) - 1] = '\0';
+#ifdef DEBUG_LOG
+ fprintf(logfile, "%-15.15s :: %s:%d(%s) ", time_s + 4, file, line, function);
+#else
fprintf(logfile, "%-15.15s :: ", time_s + 4);
+#endif
va_start(args, format);
vfprintf(logfile, format, args);
-------- end patch -----
-me
--
+---------------------------------------------------------------+
| FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
| Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
| Newbie List: http://groups.yahoo.com/group/circle-newbies/ |
+---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT