diff options
author | Matt Wilson <msw@redhat.com> | 1999-06-25 02:14:29 +0000 |
---|---|---|
committer | Matt Wilson <msw@redhat.com> | 1999-06-25 02:14:29 +0000 |
commit | 82f292a13937a8785aed282892819a4e08b5f3d9 (patch) | |
tree | 0f745245d46d4010e68c0550b82791cbb7ac66b6 /loader/log.c | |
parent | 7e82cc2de02a546a60d33ad20c7b11cd7c63b3f1 (diff) | |
download | anaconda-82f292a13937a8785aed282892819a4e08b5f3d9.tar.gz anaconda-82f292a13937a8785aed282892819a4e08b5f3d9.tar.xz anaconda-82f292a13937a8785aed282892819a4e08b5f3d9.zip |
new loader support
Diffstat (limited to 'loader/log.c')
-rw-r--r-- | loader/log.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/loader/log.c b/loader/log.c new file mode 100644 index 000000000..47b22761a --- /dev/null +++ b/loader/log.c @@ -0,0 +1,55 @@ +#include <fcntl.h> +#include <stdarg.h> +#include <stdio.h> +#include <stdlib.h> +#include <unistd.h> + +#include "log.h" + +static FILE * logfile = NULL; +static int logfd; +static int logDebugMessages = 0; + +static void doLogMessage(const char * s, va_list args); + +void logMessage(const char * s, ...) { + va_list args; + + if (!logfile) return; + + va_start(args, s); + + fprintf(logfile, "* "); + vfprintf(logfile, s, args); + fprintf(logfile, "\n"); + fflush(logfile); + + va_end(args); + + return; +} + +void openLog(int useLocal) { + if (!useLocal) { + logfile = fopen("/dev/tty3", "w"); + if (logfile) + logfd = open("/dev/tty3", O_WRONLY); + else { + logfile = fopen("/tmp/install.log", "a"); + logfd = open("/tmp/install.log", O_WRONLY| O_APPEND); + } + } else { + logfile = fopen("debug.log", "w"); + logfd = open("debug.log", O_WRONLY); + } + + if (getenv("DEBUG")) logDebugMessages = 1; +} + +void closeLog(void) { + if (logfile) { + fclose(logfile); + close(logfd); + } +} + |