summaryrefslogtreecommitdiff
path: root/src/common/log.c
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/log.c
parent4ec5e139c8442b321ef9b58684da547ea0388261 (diff)
downloadtor-e935d73b34094a88dbd997769be1c52b633fc3d3.tar.gz
tor-e935d73b34094a88dbd997769be1c52b633fc3d3.zip
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/log.c')
-rw-r--r--src/common/log.c20
1 files changed, 18 insertions, 2 deletions
diff --git a/src/common/log.c b/src/common/log.c
index 650e17b102..7e83d831a8 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 */