about summary refs log tree commit diff
path: root/src/rt/rust_port.cpp
diff options
context:
space:
mode:
authorMarijn Haverbeke <marijnh@gmail.com>2011-04-19 12:21:57 +0200
committerMarijn Haverbeke <marijnh@gmail.com>2011-04-19 16:57:13 +0200
commit880be6a94013ba0b7791b0ca1b6e16104f2f0a1c (patch)
treead8c673f13ec8d2d879175be1a006b08cc6d26d3 /src/rt/rust_port.cpp
parent6511d471bafd446026462ce0dba8ef5e2ebf462f (diff)
downloadrust-880be6a94013ba0b7791b0ca1b6e16104f2f0a1c.tar.gz
rust-880be6a94013ba0b7791b0ca1b6e16104f2f0a1c.zip
Overhaul logging system in runtime
See https://github.com/graydon/rust/wiki/Logging-vision

The runtime logging categories are now treated in the same way as
modules in compiled code. Each domain now has a log_lvl that can be
used to restrict the logging from that domain (will be used to allow
logging to be restricted to a single domain).

Features dropped (can be brought back to life if there is interest):
  - Logger indentation
  - Multiple categories per log statement
  - I possibly broke some of the color code -- it confuses me
Diffstat (limited to 'src/rt/rust_port.cpp')
-rw-r--r--src/rt/rust_port.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/rt/rust_port.cpp b/src/rt/rust_port.cpp
index 178b46a702b..57d0b216836 100644
--- a/src/rt/rust_port.cpp
+++ b/src/rt/rust_port.cpp
@@ -5,17 +5,16 @@ rust_port::rust_port(rust_task *task, size_t unit_sz) :
                      maybe_proxy<rust_port>(this), task(task),
                      unit_sz(unit_sz), writers(task->dom), chans(task->dom) {
 
-    LOG(task, rust_log::MEM | rust_log::COMM,
-              "new rust_port(task=0x%" PRIxPTR ", unit_sz=%d) -> port=0x%"
-              PRIxPTR, (uintptr_t)task, unit_sz, (uintptr_t)this);
+    LOG(task, comm,
+        "new rust_port(task=0x%" PRIxPTR ", unit_sz=%d) -> port=0x%"
+        PRIxPTR, (uintptr_t)task, unit_sz, (uintptr_t)this);
 
     // Allocate a remote channel, for remote channel data.
     remote_channel = new (task->dom) rust_chan(task, this, unit_sz);
 }
 
 rust_port::~rust_port() {
-    LOG(task, rust_log::COMM | rust_log::MEM,
-              "~rust_port 0x%" PRIxPTR, (uintptr_t) this);
+    LOG(task, comm, "~rust_port 0x%" PRIxPTR, (uintptr_t) this);
 
     //    log_state();
 
@@ -25,7 +24,7 @@ rust_port::~rust_port() {
         chan->disassociate();
 
         if (chan->ref_count == 0) {
-            LOG(task, rust_log::COMM,
+            LOG(task, comm,
                 "chan: 0x%" PRIxPTR " is dormant, freeing", chan);
             delete chan;
         }
@@ -39,7 +38,7 @@ bool rust_port::receive(void *dptr) {
         rust_chan *chan = chans[i];
         if (chan->buffer.is_empty() == false) {
             chan->buffer.dequeue(dptr);
-            LOG(task, rust_log::COMM, "<=== read data ===");
+            LOG(task, comm, "<=== read data ===");
             return true;
         }
     }
@@ -47,12 +46,12 @@ bool rust_port::receive(void *dptr) {
 }
 
 void rust_port::log_state() {
-    LOG(task, rust_log::COMM,
+    LOG(task, comm,
               "rust_port: 0x%" PRIxPTR ", associated channel(s): %d",
               this, chans.length());
     for (uint32_t i = 0; i < chans.length(); i++) {
         rust_chan *chan = chans[i];
-        LOG(task, rust_log::COMM,
+        LOG(task, comm,
             "\tchan: 0x%" PRIxPTR ", size: %d, remote: %s",
             chan,
             chan->buffer.size(),