aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-05-22 15:48:46 +0000
committerNick Mathewson <nickm@torproject.org>2007-05-22 15:48:46 +0000
commite935d73b34094a88dbd997769be1c52b633fc3d3 (patch)
treeb4ce641936e6998987b887e94374b761bd9f6d2b /src/common
parent4ec5e139c8442b321ef9b58684da547ea0388261 (diff)
downloadtor-e935d73b34094a88dbd997769be1c52b633fc3d3.tar
tor-e935d73b34094a88dbd997769be1c52b633fc3d3.tar.gz
r12852@catbus: nickm | 2007-05-22 11:00:27 -0400
Use svn revisions consistently throughout all log messages. svn:r10291
Diffstat (limited to 'src/common')
-rw-r--r--src/common/log.c20
-rw-r--r--src/common/log.h1
2 files changed, 19 insertions, 2 deletions
diff --git a/src/common/log.c b/src/common/log.c
index 650e17b10..7e83d831a 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -88,6 +88,17 @@ int _log_global_min_severity = LOG_NOTICE;
static void delete_log(logfile_t *victim);
static void close_log(logfile_t *victim);
+/** DOCDOC */
+static char *appname = NULL;
+
+/** DOCDOC */
+void
+log_set_application_name(const char *name)
+{
+ tor_free(appname);
+ appname = name ? tor_strdup(name) : NULL;
+}
+
/** Helper: Write the standard prefix for log lines to a
* <b>buf_len</b> character buffer in <b>buf</b>.
*/
@@ -140,8 +151,13 @@ log_tor_version(logfile_t *lf, int reset)
* need to log again. */
return 0;
n = _log_prefix(buf, sizeof(buf), LOG_NOTICE);
- tor_snprintf(buf+n, sizeof(buf)-n,
- "Tor %s opening %slog file.\n", VERSION, is_new?"new ":"");
+ if (appname) {
+ tor_snprintf(buf+n, sizeof(buf)-n,
+ "%s opening %slog file.\n", appname, is_new?"new ":"");
+ } else {
+ tor_snprintf(buf+n, sizeof(buf)-n,
+ "Tor %s opening %slog file.\n", VERSION, is_new?"new ":"");
+ }
if (fputs(buf, lf->file) == EOF ||
fflush(lf->file) == EOF) /* error */
return -1; /* failed */
diff --git a/src/common/log.h b/src/common/log.h
index af17e2e2c..f451599d0 100644
--- a/src/common/log.h
+++ b/src/common/log.h
@@ -113,6 +113,7 @@ void configure_libevent_logging(void);
void suppress_libevent_log_msg(const char *msg);
void change_callback_log_severity(int loglevelMin, int loglevelMax,
log_callback cb);
+void log_set_application_name(const char *name);
/* Outputs a message to stdout */
void _log(int severity, uint32_t domain, const char *format, ...)