5ec154cb370cd8ff2b4b540e3b020fccf713788f
[citadel.git] / citadel / logging.c
1 /*
2  * $Id$
3  *
4  * Everything which needs some logging...
5  *
6  */
7
8 #include "sysdep.h"
9 #include <stdlib.h>
10 #include <unistd.h>
11 #include <stdio.h>
12 #include <fcntl.h>
13 #include <signal.h>
14
15 #if TIME_WITH_SYS_TIME
16 # include <sys/time.h>
17 # include <time.h>
18 #else
19 # if HAVE_SYS_TIME_H
20 #  include <sys/time.h>
21 # else
22 #  include <time.h>
23 # endif
24 #endif
25
26 #include <ctype.h>
27 #include <string.h>
28 #include <errno.h>
29 #include <syslog.h>
30 #include "citadel.h"
31 #include "server.h"
32 #include "logging.h"
33
34
35 void rec_log(unsigned int lrtype, char *name) {
36         FILE *fp;
37         time_t now;
38
39         time(&now);
40         fp = fopen("citadel.log", "a");
41         if (fp != NULL) {
42                 fprintf(fp, "%ld|%u|%s\n", (long)now, lrtype, name);
43                 fclose(fp);
44         }
45 }