[tor-commits] [tor/release-0.2.2] Simplify syntax for negated log domains

arma at torproject.org arma at torproject.org
Fri Feb 25 18:48:53 UTC 2011


commit e261a1a3e6513eeafa1b53b83ebfec7f5d834a39
Author: Nick Mathewson <nickm at torproject.org>
Date:   Tue Jan 25 15:03:36 2011 -0500

    Simplify syntax for negated log domains
    
    Previously if you wanted to say "All messages except network
    messages", you needed to say "[*,~net]" and if you said "[~net]" by
    mistake, you would get no messages at all.  Now, if you say "[~net]",
    you get everything except networking messages.
---
 changes/log_domains |    6 +++++-
 doc/tor.1.txt       |    2 +-
 src/common/log.c    |    5 ++++-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/changes/log_domains b/changes/log_domains
index f4cfe6f..939b9a9 100644
--- a/changes/log_domains
+++ b/changes/log_domains
@@ -1,5 +1,9 @@
-  o Documentation
+  o Minor features
+    - Make it simpler to specify "All log domains except for A and B".
+      Previously you needed to say "[*,~A,~B]".  Now you can just say
+      "[~A,~B]".
 
+  o Documentation
     - Add documentation for configuring logging at different severities in
       different log domains.  We've had this feature since 0.2.1.1-alpha, but
       for some reason it never made it into the manpage.  Fixes bug 2215.
diff --git a/doc/tor.1.txt b/doc/tor.1.txt
index 9a7ee07..17cdf37 100644
--- a/doc/tor.1.txt
+++ b/doc/tor.1.txt
@@ -341,7 +341,7 @@ Other options can be specified either on the command-line (--option
     protocol, mm, http, app, control, circ, rend, bug, dir, dirserv, or, edge,
     acct, hist, and handshake.  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
     to stdout: all handshake messages of any severity, all info-and-higher
     messages from domains other than networking and memory management, and all
     messages of severity notice or higher.
diff --git a/src/common/log.c b/src/common/log.c
index 2fef2cc..28fca4e 100644
--- a/src/common/log.c
+++ b/src/common/log.c
@@ -919,7 +919,10 @@ parse_log_severity_config(const char **cfg_ptr,
       smartlist_free(domains_list);
       if (err)
         return -1;
-      domains &= ~neg_domains;
+      if (domains == 0 && neg_domains)
+        domains = ~neg_domains;
+      else
+        domains &= ~neg_domains;
       cfg = eat_whitespace(closebracket+1);
     } else {
       ++got_an_unqualified_range;





More information about the tor-commits mailing list