aboutsummaryrefslogtreecommitdiff
path: root/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/common')
-rw-r--r--src/common/log.c13
-rw-r--r--src/common/torlog.h2
2 files changed, 11 insertions, 4 deletions
diff --git a/src/common/log.c b/src/common/log.c
index e23691b6ab..8d1c40c36e 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -1099,12 +1099,19 @@ add_file_log(const log_severity_list_t *severity, const char *filename,
* Add a log handler to send messages to they system log facility.
*/
int
-add_syslog_log(const log_severity_list_t *severity)
+add_syslog_log(const log_severity_list_t *severity, const char* syslog_identity_tag)
{
logfile_t *lf;
- if (syslog_count++ == 0)
+ if (syslog_count++ == 0) {
/* This is the first syslog. */
- openlog("Tor", LOG_PID | LOG_NDELAY, LOGFACILITY);
+ static char buf[256];
+ if (syslog_identity_tag) {
+ tor_snprintf(buf, sizeof(buf), "Tor-%s", syslog_identity_tag);
+ } else {
+ tor_snprintf(buf, sizeof(buf), "Tor");
+ }
+ openlog(buf, LOG_PID | LOG_NDELAY, LOGFACILITY);
+ }
lf = tor_malloc_zero(sizeof(logfile_t));
lf->fd = -1;
diff --git a/src/common/torlog.h b/src/common/torlog.h
index 67edf14c04..57679b5f5c 100644
--- a/src/common/torlog.h
+++ b/src/common/torlog.h
@@ -135,7 +135,7 @@ void add_stream_log(const log_severity_list_t *severity, const char *name,
int add_file_log(const log_severity_list_t *severity, const char *filename,
const int truncate);
#ifdef HAVE_SYSLOG_H
-int add_syslog_log(const log_severity_list_t *severity);
+int add_syslog_log(const log_severity_list_t *severity, const char* syslog_identity_tag);
#endif
int add_callback_log(const log_severity_list_t *severity, log_callback cb);
void logs_set_domain_logging(int enabled);