[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] make --debuglogfile (or any second log file) work
Update of /home/or/cvsroot/src/common
In directory moria.mit.edu:/home2/arma/work/onion/cvs/src/common
Modified Files:
log.c log.h
Log Message:
make --debuglogfile (or any second log file) work
Index: log.c
===================================================================
RCS file: /home/or/cvsroot/src/common/log.c,v
retrieving revision 1.28
retrieving revision 1.29
diff -u -d -r1.28 -r1.29
--- log.c 19 Nov 2003 02:09:43 -0000 1.28
+++ log.c 14 Dec 2003 09:58:40 -0000 1.29
@@ -24,25 +24,24 @@
}
}
-static int loglevel = LOG_DEBUG;
static logfile_t *logfiles = NULL;
/* Format a log message into a fixed-sized buffer. (This is factored out
* of 'logv' so that we never format a message more than once.
*/
static INLINE void format_msg(char *buf, size_t buf_len,
- int severity, const char *funcname,
- const char *format, va_list ap)
+ int severity, const char *funcname,
+ const char *format, va_list ap)
{
time_t t;
struct timeval now;
int n;
buf_len -= 2; /* subtract 2 characters so we have room for \n\0 */
-
+
tor_gettimeofday(&now);
t = (time_t)now.tv_sec;
-
+
n = strftime(buf, buf_len, "%b %d %H:%M:%S", localtime(&t));
n += snprintf(buf+n, buf_len-n,
".%.3ld [%s] ",
@@ -71,10 +70,8 @@
char buf[10024];
int formatted = 0;
logfile_t *lf;
-
+
assert(format);
- if (severity < loglevel)
- return;
for (lf = logfiles; lf; lf = lf->next) {
if (severity < lf->loglevel || severity > lf->max_loglevel)
continue;
@@ -91,12 +88,6 @@
}
}
-void
-log_set_severity(int severity)
-{
- loglevel = severity;
-}
-
/* Outputs a message to stdout */
void _log(int severity, const char *format, ...)
{
Index: log.h
===================================================================
RCS file: /home/or/cvsroot/src/common/log.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- log.h 13 Dec 2003 22:52:54 -0000 1.18
+++ log.h 14 Dec 2003 09:58:40 -0000 1.19
@@ -22,8 +22,6 @@
#define CHECK_PRINTF(formatIdx, firstArg)
#endif
-void log_set_severity(int severity);
-
void add_stream_log(int loglevel, const char *name, FILE *stream);
int add_file_log(int severity, const char *filename);
void close_logs();