Add MESG as a new log domain.

This commit is contained in:
Nick Mathewson 2018-10-26 16:22:34 -04:00
parent dfd7a7f5b6
commit 0944500a8e
3 changed files with 9 additions and 4 deletions

View File

@ -679,7 +679,7 @@ GENERAL OPTIONS
The currently recognized domains are: general, crypto, net, config, fs, The currently recognized domains are: general, crypto, net, config, fs,
protocol, mm, http, app, control, circ, rend, bug, dir, dirserv, or, edge, protocol, mm, http, app, control, circ, rend, bug, dir, dirserv, or, edge,
acct, hist, handshake, heartbeat, channel, sched, guard, consdiff, dos, acct, hist, handshake, heartbeat, channel, sched, guard, consdiff, dos,
process, pt, and btrack. process, pt, btrack, and mesg.
Domain names are case-insensitive. + Domain names are case-insensitive. +
+ +
For example, "`Log [handshake]debug [~net,~mm]info notice stdout`" sends For example, "`Log [handshake]debug [~net,~mm]info notice stdout`" sends

View File

@ -49,6 +49,7 @@
#include "lib/wallclock/approx_time.h" #include "lib/wallclock/approx_time.h"
#include "lib/wallclock/time_to_tm.h" #include "lib/wallclock/time_to_tm.h"
#include "lib/fdio/fdio.h" #include "lib/fdio/fdio.h"
#include "lib/cc/ctassert.h"
#ifdef HAVE_ANDROID_LOG_H #ifdef HAVE_ANDROID_LOG_H
#include <android/log.h> #include <android/log.h>
@ -1268,9 +1269,12 @@ static const char *domain_list[] = {
"GENERAL", "CRYPTO", "NET", "CONFIG", "FS", "PROTOCOL", "MM", "GENERAL", "CRYPTO", "NET", "CONFIG", "FS", "PROTOCOL", "MM",
"HTTP", "APP", "CONTROL", "CIRC", "REND", "BUG", "DIR", "DIRSERV", "HTTP", "APP", "CONTROL", "CIRC", "REND", "BUG", "DIR", "DIRSERV",
"OR", "EDGE", "ACCT", "HIST", "HANDSHAKE", "HEARTBEAT", "CHANNEL", "OR", "EDGE", "ACCT", "HIST", "HANDSHAKE", "HEARTBEAT", "CHANNEL",
"SCHED", "GUARD", "CONSDIFF", "DOS", "PROCESS", "PT", "BTRACK", NULL "SCHED", "GUARD", "CONSDIFF", "DOS", "PROCESS", "PT", "BTRACK", "MESG",
NULL
}; };
CTASSERT(ARRAY_LENGTH(domain_list) == N_LOGGING_DOMAINS + 1);
/** Return a bitmask for the log domain for which <b>domain</b> is the name, /** Return a bitmask for the log domain for which <b>domain</b> is the name,
* or 0 if there is no such name. */ * or 0 if there is no such name. */
static log_domain_mask_t static log_domain_mask_t

View File

@ -113,8 +113,9 @@
#define LD_PT (1u<<27) #define LD_PT (1u<<27)
/** Bootstrap tracker. */ /** Bootstrap tracker. */
#define LD_BTRACK (1u<<28) #define LD_BTRACK (1u<<28)
/** Number of logging domains in the code. */ /** Message-passing backend. */
#define N_LOGGING_DOMAINS 29 #define LD_MESG (1u<<29)
#define N_LOGGING_DOMAINS 30
/** This log message is not safe to send to a callback-based logger /** This log message is not safe to send to a callback-based logger
* immediately. Used as a flag, not a log domain. */ * immediately. Used as a flag, not a log domain. */