Skip to content

Commit

Permalink
Add an option for forced log flushing, useful in some debug scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
brad-sp committed Nov 25, 2015
1 parent 4a0447e commit fd00498
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions config.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ int read_config(void)
else if (!strcmp(key, "full-logs")) {
g_config.full_logs = value[0] == '1';
}
else if (!strcmp(key, "force-flush")) {
g_config.force_flush = value[0] == '1';
}
else if (!strcmp(key, "terminate-event")) {
strncpy(g_config.terminate_event_name, value,
ARRAYSIZE(g_config.terminate_event_name));
Expand Down
3 changes: 3 additions & 0 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ struct _g_config {
// do we force sleep-skipping despite threads?
int force_sleepskip;

// do we force flushing of each log?
int force_flush;

// server ip and port
//unsigned int host_ip;
//unsigned short host_port;
Expand Down
3 changes: 2 additions & 1 deletion log.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,7 +891,8 @@ void loq(int index, const char *category, const char *name,
free(lastlog.buf);
lastlog.buf = NULL;
// flush logs once we're done seeing duplicates of a particular API
//log_flush();
if (g_config.force_flush)
log_flush();
}
}
if (lastlog.buf == NULL) {
Expand Down

0 comments on commit fd00498

Please sign in to comment.