summaryrefslogtreecommitdiff
path: root/src/common/log.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2017-11-20 16:52:55 -0500
committerChelsea Holland Komlo <me@chelseakomlo.com>2017-12-21 15:28:29 -0500
commit719db28f54ad1fa957999f2a6256e07bdb412e4f (patch)
treef88857774ed4b86442026775515ddea46a7a52a8 /src/common/log.c
parentf5d89fab2525fd8a105f9f0ea9258147bf16290e (diff)
downloadtor-719db28f54ad1fa957999f2a6256e07bdb412e4f.tar.gz
tor-719db28f54ad1fa957999f2a6256e07bdb412e4f.zip
Add minimal implementations of functions Rust needs for logging
Diffstat (limited to 'src/common/log.c')
-rw-r--r--src/common/log.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/src/common/log.c b/src/common/log.c
index ac6d07a929..608ffea950 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -225,6 +225,30 @@ log_set_application_name(const char *name)
appname = name ? tor_strdup(name) : NULL;
}
+/** Return true if some of the running logs might be interested in a log
+ * message of the given severity in the given domains. If this function
+ * returns true, the log message might be ignored anyway, but if it returns
+ * false, it is definitely_ safe not to log the message. */
+int
+log_message_is_interesting(int severity, log_domain_mask_t domain)
+{
+ (void) domain;
+ return (severity <= log_global_min_severity_);
+}
+
+/**
+ * As tor_log, but takes an optional function name, and does not treat its
+ * <b>string</b> as a printf format.
+ *
+ * For use by Rust integration.
+ */
+void
+tor_log_string(int severity, log_domain_mask_t domain,
+ const char *function, const char *string)
+{
+ log_fn_(severity, domain, function, "%s", string);
+}
+
/** Log time granularity in milliseconds. */
static int log_time_granularity = 1;