logging.c 1.06 KB
Newer Older
Andrei Paskevich's avatar
Andrei Paskevich committed
1 2 3 4 5 6 7 8 9 10 11
/********************************************************************/
/*                                                                  */
/*  The Why3 Verification Platform   /   The Why3 Development Team  */
/*  Copyright 2010-2016   --   INRIA - CNRS - Paris-Sud University  */
/*                                                                  */
/*  This software is distributed under the terms of the GNU Lesser  */
/*  General Public License version 2.1, with the special exception  */
/*  on linking described in file LICENSE.                           */
/*                                                                  */
/********************************************************************/

12 13 14
#include <stdio.h>
#include <stdlib.h>
#include "logging.h"
15
#include "options.h"
16 17 18 19

FILE* logfile;

void init_logging() {
20
  if (logging) {
21
   logfile = fopen("why3server.log", "w");
22
  }
23 24 25
}

void log_msg(char* s) {
26
  if (logging) {
27
   fprintf (logfile, "%s\n", s);
28
  }
29 30 31
}

void logging_shutdown(char* s) {
32
  if (logging) {
33 34
   log_msg(s);
   fclose(logfile);
35
  }
36 37
   exit(1);
}