summaryrefslogtreecommitdiff
path: root/src/common/log.c
diff options
context:
space:
mode:
authorRoger Dingledine <arma@torproject.org>2003-12-14 09:58:43 +0000
committerRoger Dingledine <arma@torproject.org>2003-12-14 09:58:43 +0000
commita5aa80cc419d6831ce339496a1c644f2347496a2 (patch)
tree38dc3260f6b27132bc159ac236749bcec8408d3c /src/common/log.c
parenta0f16c619cca24d9904b3beb0902fdf7da4927df (diff)
downloadtor-a5aa80cc419d6831ce339496a1c644f2347496a2.tar.gz
tor-a5aa80cc419d6831ce339496a1c644f2347496a2.zip
make --debuglogfile (or any second log file) work
svn:r935
Diffstat (limited to 'src/common/log.c')
-rw-r--r--src/common/log.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/src/common/log.c b/src/common/log.c
index 397d27aaf1..791883c165 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -24,25 +24,24 @@ static INLINE const char *sev_to_string(int severity) {
}
}
-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 @@ logv(int severity, const char *funcname, const char *format, va_list ap)
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 @@ logv(int severity, const char *funcname, const char *format, va_list ap)
}
}
-void
-log_set_severity(int severity)
-{
- loglevel = severity;
-}
-
/* Outputs a message to stdout */
void _log(int severity, const char *format, ...)
{