Remove time in weechat.log file when dumping data (crash or user is asking dump)

This commit is contained in:
Sebastien Helleu 2009-04-26 09:43:06 +02:00
parent c3321b1406
commit 0a8077f0d6
4 changed files with 24 additions and 11 deletions

View File

@ -831,7 +831,10 @@ command_debug (void *data, struct t_gui_buffer *buffer,
if (string_strcasecmp (argv[1], "dump") == 0)
{
log_printf ("Dump request for WeeChat core and plugins");
weechat_log_use_time = 0;
hook_signal_send ("debug_dump", WEECHAT_HOOK_SIGNAL_STRING, NULL);
weechat_log_use_time = 1;
}
else if (string_strcasecmp (argv[1], "buffer") == 0)
{

View File

@ -64,6 +64,7 @@ debug_dump (int crash)
{
debug_dump_active = 1;
log_printf ("Very bad, WeeChat is crashing (SIGSEGV received)...");
weechat_log_use_time = 0;
}
log_printf ("");

View File

@ -38,11 +38,14 @@
#include "weechat.h"
#include "wee-log.h"
#include "wee-debug.h"
#include "wee-string.h"
char *weechat_log_filename = NULL; /* log name (~/.weechat/weechat.log) */
FILE *weechat_log_file = NULL; /* WeeChat log file */
int weechat_log_use_time = 1; /* 0 to temporary disable time in log, */
/* for example when dumping data */
/*
@ -143,6 +146,10 @@ log_printf (const char *message, ...)
ptr_buffer++;
}
if (!weechat_log_use_time)
string_iconv_fprintf (weechat_log_file, "%s\n", buffer);
else
{
seconds = time (NULL);
date_tmp = localtime (&seconds);
if (date_tmp)
@ -154,6 +161,7 @@ log_printf (const char *message, ...)
buffer);
else
string_iconv_fprintf (weechat_log_file, "%s\n", buffer);
}
fflush (weechat_log_file);
}

View File

@ -22,6 +22,7 @@
extern char *weechat_log_filename;
extern FILE *weechat_log_file;
extern int weechat_log_use_time;
extern void log_init ();
extern void log_close ();