do not write single chars to log file.
git-svn-id: svn://svn.berlios.de/openocd/trunk@388 b42882b7-edfa-0310-969c-e2dbd0fdcd60__archive__
parent
43126e8f49
commit
0a749feb8e
|
@ -48,7 +48,16 @@ static char *log_strings[5] =
|
||||||
|
|
||||||
static int count = 0;
|
static int count = 0;
|
||||||
|
|
||||||
|
/* The log_printfv() serves to somewhat different goals:
|
||||||
|
*
|
||||||
|
* - logging
|
||||||
|
* - feeding low-level info to the user in GDB or Telnet
|
||||||
|
*
|
||||||
|
* The latter dictates that strings without newline are not logged, lest there
|
||||||
|
* will be *MANY log lines when sending one char at the time(e.g.
|
||||||
|
* target_request.c).
|
||||||
|
*
|
||||||
|
*/
|
||||||
static void log_puts(enum log_levels level, const char *file, int line, const char *function, const char *string)
|
static void log_puts(enum log_levels level, const char *file, int line, const char *function, const char *string)
|
||||||
{
|
{
|
||||||
log_callback_t *cb;
|
log_callback_t *cb;
|
||||||
|
@ -65,6 +74,8 @@ static void log_puts(enum log_levels level, const char *file, int line, const ch
|
||||||
if (f != NULL)
|
if (f != NULL)
|
||||||
file = f + 1;
|
file = f + 1;
|
||||||
|
|
||||||
|
if (strchr(buffer, '\n')!=NULL)
|
||||||
|
{
|
||||||
if (debug_level >= LOG_DEBUG)
|
if (debug_level >= LOG_DEBUG)
|
||||||
{
|
{
|
||||||
/* print with count and time information */
|
/* print with count and time information */
|
||||||
|
@ -76,6 +87,11 @@ static void log_puts(enum log_levels level, const char *file, int line, const ch
|
||||||
/* do not print count and time */
|
/* do not print count and time */
|
||||||
fprintf(log_output, "%s %s:%d %s(): %s", log_strings[level+1], file, line, function, string);
|
fprintf(log_output, "%s %s:%d %s(): %s", log_strings[level+1], file, line, function, string);
|
||||||
}
|
}
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
/* only entire lines are logged. Otherwise it's
|
||||||
|
* single chars intended for the log callbacks. */
|
||||||
|
}
|
||||||
|
|
||||||
fflush(log_output);
|
fflush(log_output);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue