From 186ce6a5ec161153e2c9c3e6743f8bf989756893 Mon Sep 17 00:00:00 2001 From: Jean-loup Gailly Date: Thu, 1 Apr 2010 23:42:37 +0200 Subject: [PATCH] Make distributed engine much less verbose by default. --- distributed/distributed.c | 11 ++++++++--- gtp.c | 7 +++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/distributed/distributed.c b/distributed/distributed.c index 00c748f..382e326 100644 --- a/distributed/distributed.c +++ b/distributed/distributed.c @@ -196,7 +196,7 @@ get_reply(FILE *f, struct in_addr client, char *reply) *reply = '\0'; char *line = reply; while (fgets(line, reply + CMDS_SIZE - line, f) && *line != '\n') { - if (DEBUGL(2)) + if (DEBUGL(3) || (DEBUGL(2) && line == reply)) logline(&client, "<<", line); if (reply_id < 0 && (*line == '=' || *line == '?') && isdigit(line[1])) reply_id = atoi(line+1); @@ -241,10 +241,15 @@ slave_loop(FILE *f, struct in_addr client, char *reply_buf, bool resend) logline(&client, "? ", "Slave behind, partial resend\n"); } } - if (DEBUGL(2)) - logline(&client, ">>", buf); fputs(buf, f); fflush(f); + if (DEBUGL(2)) { + if (!DEBUGL(3)) { + char *s = strchr(buf, '\n'); + if (s) s[1] = '\0'; + } + logline(&client, ">>", buf); + } /* Read the reply, which always ends with \n\n * The slave machine sends "=id reply" or "?id reply" diff --git a/gtp.c b/gtp.c index a3c59bc..5d4b7eb 100644 --- a/gtp.c +++ b/gtp.c @@ -237,7 +237,7 @@ gtp_parse(struct board *board, struct engine *engine, struct time_info *ti, char gtp_error(id, "illegal move", NULL); } else { if (DEBUGL(1)) - board_print(board, stderr); + board_print_custom(board, stderr, engine->printhook); gtp_reply(id, reply, NULL); } @@ -277,11 +277,10 @@ gtp_parse(struct board *board, struct engine *engine, struct time_info *ti, char gtp_error(id, "genmoves error", NULL); return P_OK; } - if (DEBUGL(2)) + if (DEBUGL(3)) fprintf(stderr, "proposing moves %s\n", reply); - if (DEBUGL(1)) { + if (DEBUGL(4)) board_print_custom(board, stderr, engine->printhook); - } gtp_reply(id, reply, NULL); } else if (!strcasecmp(cmd, "set_free_handicap")) { -- 2.11.4.GIT