mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2025-02-26 15:42:34 +01:00
Add minimal implementations of functions Rust needs for logging
This commit is contained in:
parent
f5d89fab25
commit
719db28f54
2 changed files with 28 additions and 0 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -189,6 +189,10 @@ void log_fn_ratelim_(struct ratelim_t *ratelim, int severity,
|
|||
const char *format, ...)
|
||||
CHECK_PRINTF(5,6);
|
||||
|
||||
int log_message_is_interesting(int severity, log_domain_mask_t domain);
|
||||
void tor_log_string(int severity, log_domain_mask_t domain,
|
||||
const char *function, const char *string);
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ <= 3
|
||||
|
||||
/* These are the GCC varidaic macros, so that older versions of GCC don't
|
||||
|
|
Loading…
Add table
Reference in a new issue