logging.c 371 Bytes
Newer Older
1 2 3
#include <stdio.h>
#include <stdlib.h>
#include "logging.h"
4
#include "options.h"
5 6 7 8

FILE* logfile;

void init_logging() {
9
  if (logging) {
10
   logfile = fopen("why3server.log", "w");
11
  }
12 13 14
}

void log_msg(char* s) {
15
  if (logging) {
16
   fprintf (logfile, "%s\n", s);
17
  }
18 19 20
}

void logging_shutdown(char* s) {
21
  if (logging) {
22 23
   log_msg(s);
   fclose(logfile);
24
  }
25 26
   exit(1);
}