From 52bc42755cb153a357d44d91d8fc069a10385a56 Mon Sep 17 00:00:00 2001 From: Art Cancro Date: Sun, 12 Jul 1998 22:37:30 +0000 Subject: [PATCH] This is part of the server core. It contains code relating to the writing 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 | 1 + citadel/logging.c | 29 +++++++++++++++++++++++++++++ citadel/readlog.c | 3 +-- citadel/stats.c | 7 ++++++- 4 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 citadel/logging.c diff --git a/citadel/citserver.c b/citadel/citserver.c index d3cd6ed3d..ead5ddc56 100644 --- a/citadel/citserver.c +++ b/citadel/citserver.c @@ -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 index 000000000..9de7305c1 --- /dev/null +++ b/citadel/logging.c @@ -0,0 +1,29 @@ +/* + * Everything which needs some logging... + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#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); + } diff --git a/citadel/readlog.c b/citadel/readlog.c index 2bd217e4a..a54a24d71 100644 --- a/citadel/readlog.c +++ b/citadel/readlog.c @@ -1,6 +1,5 @@ /* - * readlog.c - * v1.5 + * readlog.c (a simple program to parse citadel.log) */ #include diff --git a/citadel/stats.c b/citadel/stats.c index 3a8b877fa..e5664f5d7 100644 --- a/citadel/stats.c +++ b/citadel/stats.c @@ -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); + */ } } -- 2.39.2