This is part of the server core. It contains code relating to the writing
authorArt Cancro <ajc@citadel.org>
Sun, 12 Jul 1998 22:37:30 +0000 (22:37 +0000)
committerArt Cancro <ajc@citadel.org>
Sun, 12 Jul 1998 22:37:30 +0000 (22:37 +0000)
of log records (stuff that goes in citadel.log).  It's not very big right
now, but I put it into its own file so that we can potentially do more with
it later.

citadel/citserver.c
citadel/logging.c [new file with mode: 0644]
citadel/readlog.c
citadel/stats.c

index d3cd6ed3d576c305b023372a071b1659ecd7fb7a..ead5ddc5628709b7dbf43150f580f99cd07118d4 100644 (file)
@@ -638,6 +638,7 @@ void *context_loop(struct CitContext *con)
 
        lprintf(3, "citserver[%3d]: started.\n", CC->cs_pid);
        hook_start_session(CC->cs_pid);
+       rec_log(CL_CONNECT, "");
 
        do {
                time(&CC->lastcmd);
diff --git a/citadel/logging.c b/citadel/logging.c
new file mode 100644 (file)
index 0000000..9de7305
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Everything which needs some logging...
+ */
+
+#include <stdlib.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <fcntl.h>
+#include <signal.h>
+#include <time.h>
+#include <ctype.h>
+#include <string.h>
+#include <errno.h>
+#include <pthread.h>
+#include <syslog.h>
+#include "citadel.h"
+#include "server.h"
+#include "proto.h"
+
+
+void rec_log(unsigned int lrtype, char *name) {
+       FILE *fp;
+       time_t now;
+
+       time(&now);
+       fp = fopen("citadel.log", "a");
+       fprintf(fp, "%ld|%u|%s\n", now, lrtype, name);
+       fclose(fp);
+       }
index 2bd217e4a152c910808690c4bf31aca45db58afa..a54a24d7150043923d3847dec30181e455959e61 100644 (file)
@@ -1,6 +1,5 @@
 /* 
- * readlog.c
- * v1.5
+ * readlog.c  (a simple program to parse citadel.log)
  */
 
 #include <stdlib.h>
index 3a8b877faf5f2add9cdfddca83b6ae9cc6107217..e5664f5d754a887e22e92fb6e65885de7a785d16 100644 (file)
@@ -102,7 +102,6 @@ main (argc, argv)
   time_t LogTime;
   unsigned int LogType;
   char LogName[256];
-  struct usersupp usersupp;
   int a, b, lowest;
   float p, q;
   long timeon[72];
@@ -351,6 +350,11 @@ main (argc, argv)
       prompt ();
 
     PC_ONLY_HERE:
+
+
+/*
+  This report doesn't work anymore, because it requires reading the user
+  file directly, which can't happen.
       printf ("Top 20 Contributing Users (post to call ratio)\n");
       printf ("P/C Ratio Username\n");
       printf ("--------- ------------------------------\n");
@@ -367,5 +371,6 @@ main (argc, argv)
       fclose (fp);
       pclose (sortpipe);
       exit (0);
+ */
     }
 }