diff --git a/src/rt/rust_log.h b/src/rt/rust_log.h index eac3bf62fb8..715ced0ef7b 100644 --- a/src/rt/rust_log.h +++ b/src/rt/rust_log.h @@ -3,18 +3,20 @@ #define RUST_LOG_H const uint32_t log_err = 0; -const uint32_t log_note = 1; +const uint32_t log_warn = 1; +const uint32_t log_info = 2; +const uint32_t log_debug = 3; #define LOG(task, field, ...) \ - DLOG_LVL(log_note, task, task->sched, field, __VA_ARGS__) + DLOG_LVL(log_debug, task, task->sched, field, __VA_ARGS__) #define LOG_ERR(task, field, ...) \ DLOG_LVL(log_err, task, task->sched, field, __VA_ARGS__) #define DLOG(sched, field, ...) \ - DLOG_LVL(log_note, NULL, sched, field, __VA_ARGS__) + DLOG_LVL(log_debug, NULL, sched, field, __VA_ARGS__) #define DLOG_ERR(sched, field, ...) \ DLOG_LVL(log_err, NULL, sched, field, __VA_ARGS__) #define LOGPTR(sched, msg, ptrval) \ - DLOG_LVL(log_note, NULL, sched, mem, "%s 0x%" PRIxPTR, msg, ptrval) + DLOG_LVL(log_debug, NULL, sched, mem, "%s 0x%" PRIxPTR, msg, ptrval) #define DLOG_LVL(lvl, task, sched, field, ...) \ do { \ rust_scheduler* _d_ = sched; \ @@ -24,7 +26,7 @@ const uint32_t log_note = 1; } while (0) #define KLOG(k, field, ...) \ - KLOG_LVL(k, field, log_note, __VA_ARGS__) + KLOG_LVL(k, field, log_debug, __VA_ARGS__) #define KLOG_LVL(k, field, lvl, ...) \ do { \ if (log_rt_##field >= lvl) { \ diff --git a/src/rt/rust_scheduler.cpp b/src/rt/rust_scheduler.cpp index 03567bbe19a..bf40fea36ee 100644 --- a/src/rt/rust_scheduler.cpp +++ b/src/rt/rust_scheduler.cpp @@ -19,7 +19,7 @@ rust_scheduler::rust_scheduler(rust_kernel *kernel, ref_count(1), interrupt_flag(0), _log(srv, this), - log_lvl(log_note), + log_lvl(log_debug), srv(srv), // TODO: calculate a per scheduler name. name("main"), @@ -203,12 +203,12 @@ rust_scheduler::schedule_task(int id) { void rust_scheduler::log_state() { - if (log_rt_task < log_note) return; + if (log_rt_task < log_debug) return; if (!running_tasks.is_empty()) { - log(NULL, log_note, "running tasks:"); + log(NULL, log_debug, "running tasks:"); for (size_t i = 0; i < running_tasks.length(); i++) { - log(NULL, log_note, "\t task: %s @0x%" PRIxPTR + log(NULL, log_debug, "\t task: %s @0x%" PRIxPTR " remaining: %" PRId64 " us", running_tasks[i]->name, running_tasks[i], @@ -217,9 +217,9 @@ rust_scheduler::log_state() { } if (!blocked_tasks.is_empty()) { - log(NULL, log_note, "blocked tasks:"); + log(NULL, log_debug, "blocked tasks:"); for (size_t i = 0; i < blocked_tasks.length(); i++) { - log(NULL, log_note, "\t task: %s @0x%" PRIxPTR ", blocked on: 0x%" + log(NULL, log_debug, "\t task: %s @0x%" PRIxPTR ", blocked on: 0x%" PRIxPTR " '%s'", blocked_tasks[i]->name, blocked_tasks[i], blocked_tasks[i]->cond, blocked_tasks[i]->cond_name); @@ -227,9 +227,9 @@ rust_scheduler::log_state() { } if (!dead_tasks.is_empty()) { - log(NULL, log_note, "dead tasks:"); + log(NULL, log_debug, "dead tasks:"); for (size_t i = 0; i < dead_tasks.length(); i++) { - log(NULL, log_note, "\t task: %s 0x%" PRIxPTR, + log(NULL, log_debug, "\t task: %s 0x%" PRIxPTR, dead_tasks[i]->name, dead_tasks[i]); } } diff --git a/src/rt/rust_scheduler.h b/src/rt/rust_scheduler.h index ad3203e43c3..39fd4a07f81 100644 --- a/src/rt/rust_scheduler.h +++ b/src/rt/rust_scheduler.h @@ -43,7 +43,15 @@ struct rust_scheduler : public kernel_owned, // Fields known only by the runtime: rust_log _log; + + // NB: this is used to filter *runtime-originating* debug + // logging, on a per-scheduler basis. It's not likely what + // you want to expose to the user in terms of per-task + // or per-module logging control. By default all schedulers + // are set to debug-level logging here, and filtered by + // runtime category using the pseudo-modules ::rt::foo. uint32_t log_lvl; + rust_srv *srv; const char *const name; diff --git a/src/rt/rust_shape.cpp b/src/rt/rust_shape.cpp index c4d9eb6a5a4..bd388ffff82 100644 --- a/src/rt/rust_shape.cpp +++ b/src/rt/rust_shape.cpp @@ -555,8 +555,6 @@ shape_cmp_type(int8_t *result, const type_desc *tydesc, extern "C" void shape_log_type(const type_desc *tydesc, uint8_t *data, uint32_t level) { rust_task *task = rust_scheduler::get_task(); - if (task->sched->log_lvl < level) - return; // TODO: Don't evaluate at all? shape::arena arena; shape::type_param *params =