about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKeegan McAllister <kmcallister@mozilla.com>2013-07-25 13:24:32 -0700
committerKeegan McAllister <kmcallister@mozilla.com>2013-07-25 13:24:32 -0700
commitd0f54a5cfb13e9ec437083666eb1b2cca6a39941 (patch)
treecf1f239faf35b69ec924dfd89fa019f6cdfd39a9
parentbaa649ede6df96f645a9e28acfdc0b66b63e48b5 (diff)
downloadrust-d0f54a5cfb13e9ec437083666eb1b2cca6a39941.tar.gz
rust-d0f54a5cfb13e9ec437083666eb1b2cca6a39941.zip
Warn about unused RUST_LOG specs
-rw-r--r--src/rt/rust_log.cpp13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/rt/rust_log.cpp b/src/rt/rust_log.cpp
index 8179c53e96d..f7b117a8cb1 100644
--- a/src/rt/rust_log.cpp
+++ b/src/rt/rust_log.cpp
@@ -234,7 +234,9 @@ static void update_entry(const mod_entry* entry, void *cookie) {
         }
     }
     *entry->state = level;
-    (*args->n_matches)++;
+    if (longest_match > 0) {
+        (*args->n_matches)++;
+    }
 }
 
 void update_module_map(const mod_entry* map, log_directive* dirs,
@@ -318,11 +320,10 @@ void update_log_settings(void* crate_map, char* settings) {
                      n_dirs, &n_matches);
 
     if (n_matches < n_dirs) {
-        // NB: Android compiler is complaining about format specifiers here
-        // and I don't understand why
-        /*printf("warning: got %" PRIdPTR " RUST_LOG specs, "
-               "enabled %" PRIdPTR " flags.",
-               (uintptr_t)n_dirs, (uintptr_t)n_matches);*/
+        fprintf(stderr, "warning: got %lu RUST_LOG specs but only matched %lu of them.\n"
+                "You may have mistyped a RUST_LOG spec.\n"
+                "Use RUST_LOG=::help to see the list of crates and modules.\n",
+                (unsigned long)n_dirs, (unsigned long)n_matches);
     }
 
     free(buffer);