Added the LOG macro to simplify logging :)
[cacao.git] / toolbox / loging.h
1 /************************* toolbox/loging.h ************************************
2
3         Copyright (c) 1997 A. Krall, R. Grafl, M. Gschwind, M. Probst
4
5         See file COPYRIGHT for information on usage and disclaimer of warranties
6
7         Stellt Funktionen f"urs Logging zur Verf"ugung
8
9         Authors: Reinhard Grafl      EMAIL: cacao@complang.tuwien.ac.at
10
11         Last Change: $Id: loging.h 65 1998-11-11 21:12:27Z phil $
12
13 *******************************************************************************/
14
15 #define PANICIF(when,txt)  if(when)panic(txt)
16
17 /*
18  * Just added the LOG macro, so we our code becomes a little more
19  * readable, again. --phil.
20  */
21 #define LOG(args...)               sprintf(logtext, ## args); dolog();
22
23 #define MAXLOGTEXT 500
24 extern char logtext[MAXLOGTEXT];
25
26 void log_init(char *fname);
27 void log_text(char *txt);
28
29 void log_cputime();
30
31 void dolog();
32 void error();
33 void panic(char *txt);
34
35 long int getcputime();
36
37
38 /*
39
40 -------------------------- Schnittstellenbeschreibung -------------------------
41
42 log_init .... Initialisiert das Logfile-System 
43                fname ....... Dateiname f"ur die Protokollierungsdatei
44                keepfile .... 1, wenn die alte Datei nicht gel"oscht werden soll
45                echostdout .. 1, wenn auch auf stdout ausgegeben werden soll
46                
47 log_text .... Gibt einen Text auf das Logfile aus
48 log_cputime . Gibt eine Information "uber die verbrauchte CPU-Zeit aus
49 dolog ....... Gibt den Inhalt von logtext aus
50 error ....... Gibt den Inhalt von logtext aus, und stoppt das System
51 panic ....... Gibt eine Text auf das Logfile aus
52
53 logtext ..... dieses globale Array mu"s vor Benutzung der Funktionen 'log' 
54               oder 'error' mit dem auszugebenen Text bef"ullt werden.
55
56 getcputimew . gibt die vom Programm verbrauchte CPU-Zeit in
57               Mikrosekunden zur"uck
58
59 */