Phases 0-1 + Sprint A: module split, CLI layer, org-refresh fix, hygiene
- LICENSE (MIT) + README truth-pass; docs/cli.md CLI contract - CLI subcommands (src/cli_cmds/) per "TUI for users, CLI for users+AI" - Hub/detail refactor: keymap dispatch, modal split, action enum, BgMsg bus - Fix: org repos were never refreshed (owner==username match); refresh now parallel — 49 repos in ~11s, surfaced 70 previously invisible PRs - Fix: 3 date bugs in detail/git.rs (format-local, Local::now, 1y month math) - Stash indicator + [m] actions, session persistence, gh CLI token fallback - Legacy UI modules removed; plan/ docs (roadmap, audit, debate, handoff)
This commit is contained in:
1 parent
5787b14880
commit
0468c032c6
100 files changed
+11614
-9840
No files matched your search
+13
-3
@@ -1,21 +1,31 @@
|
||||
//! Timing debug log shown in the hub's bottom debug panel (`--debug` flag).
|
||||
//! Backed by thread-locals rather than a field threaded through every
|
||||
//! function, since logging is opt-in and call sites are scattered across
|
||||
//! the codebase wherever something worth timing happens.
|
||||
|
||||
use std::cell::RefCell;
|
||||
use std::time::Instant;
|
||||
|
||||
thread_local! {
|
||||
static ENABLED: RefCell<bool> = RefCell::new(false);
|
||||
static LOG: RefCell<Vec<String>> = RefCell::new(Vec::new());
|
||||
static T0: RefCell<Option<Instant>> = RefCell::new(None);
|
||||
static ENABLED: RefCell<bool> = const { RefCell::new(false) };
|
||||
static LOG: RefCell<Vec<String>> = const { RefCell::new(Vec::new()) };
|
||||
static T0: RefCell<Option<Instant>> = const { RefCell::new(None) };
|
||||
}
|
||||
|
||||
/// Turns on debug logging and starts the elapsed-time clock used to
|
||||
/// timestamp subsequent `log` entries.
|
||||
pub fn enable() {
|
||||
ENABLED.with(|e| *e.borrow_mut() = true);
|
||||
T0.with(|t| *t.borrow_mut() = Some(Instant::now()));
|
||||
}
|
||||
|
||||
/// Whether debug logging is currently on.
|
||||
pub fn is_enabled() -> bool {
|
||||
ENABLED.with(|e| *e.borrow())
|
||||
}
|
||||
|
||||
/// Appends a timestamped entry to the debug log. A no-op when logging isn't
|
||||
/// enabled, so call sites don't need to guard every call with `is_enabled()`.
|
||||
pub fn log(msg: impl Into<String>) {
|
||||
if !is_enabled() { return; }
|
||||
let ms = T0.with(|t| t.borrow().map(|i| i.elapsed().as_millis()).unwrap_or(0));
|
||||
|
||||
Reference in new issue
Block a user