Преглед на файлове

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.
Nick Mathewson преди 13 години
родител
ревизия
e261a1a3e6
променени са 3 файла, в които са добавени 10 реда и са изтрити 3 реда
  1. 5 1
      changes/log_domains
  2. 1 1
      doc/tor.1.txt
  3. 4 1
      src/common/log.c

+ 5 - 1
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.

+ 1 - 1
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.

+ 4 - 1
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;