Commit dd20b23c authored by Mike Hibler's avatar Mike Hibler

Add logflush() routine so we can force flush of non-syslog logs.

Not used in Emulab software proper, but keeps this file in synch with
pubsub version (thus avoiding link problems).
parent 8ff9f737
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2003 University of Utah and the Flux Group.
* Copyright (c) 2000-2007 University of Utah and the Flux Group.
* All rights reserved.
*/
......@@ -21,9 +21,12 @@
static int usesyslog = 0;
static char *filename;
#define LOG_IDENT "Testbed"
/*
* Init.
* Initialize. If slog is non-zero use syslog with name (if provided)
* as the identifier. If slog is zero, then name (if set) is the name of
* a logfile to which stdout and stderr are redirected.
*/
int
loginit(int slog, char *name)
......@@ -31,7 +34,7 @@ loginit(int slog, char *name)
if (slog) {
usesyslog = 1;
if (! name)
name = "Testbed";
name = LOG_IDENT;
openlog(name, LOG_PID, LOG_TESTBED);
return 0;
}
......@@ -61,6 +64,16 @@ logsyslog(void)
usesyslog = 1;
}
/*
* Flush any buffered log output
*/
void
logflush(void)
{
if (!usesyslog)
fflush(stderr);
}
void
info(const char *fmt, ...)
{
......
/*
* EMULAB-COPYRIGHT
* Copyright (c) 2000-2004 University of Utah and the Flux Group.
* Copyright (c) 2000-2007 University of Utah and the Flux Group.
* All rights reserved.
*/
......@@ -15,6 +15,7 @@ extern "C" {
int loginit(int usesyslog, char *name);
void logsyslog(void);
void logflush(void);
void info(const char *fmt, ...);
void warning(const char *fmt, ...);
void error(const char *fmt, ...);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment