[ SKIP TO MAIN CONTENT ↵ ]
SPECIFICATION // logd
PRODUCTION
Dart & Flutter Observability Runtime

logd

Hierarchical logging engine with declarative subsystem control, ambient Zone context, non-blocking background isolate execution, and token-optimized AI telemetry.

★ 10 GITHUB STARS160/160 PUB POINTS1,348 30-DAY DOWNLOADS♥ 8 PUB LIKESWASM READY
v0.10.6 on pub.dev
PUB.DEV VERIFIED SCORE160 / 160 (100% Max)
30-DAY DOWNLOADS1,348 Installs
PLATFORM COVERAGE6/6 Platforms (All Supported)
CONCURRENCY ENGINEWorker Isolate (.async())
FRAME BUDGET120Hz Zero-Jank (8.3ms)
AI TELEMETRY FORMATTOON (-40% Prompt Tokens)
01 // ARCHITECTURAL PHILOSOPHY

Logging as an Enabling Instrument

In simple CRUD interfaces, standard console logs or formatted terminal boxes serve their purpose. But when building a complex system with continuous calculations, background isolate computations, and high-frequency state transitions, real-time observability is not a convenience—it is the only window into the health of the machine.

Available tools in the Dart ecosystem generally fell into two extremes: low-level event emitters with no formatting or sinks, or synchronous main-thread console printers that drop UI frames under load. Neither allowed declarative on-the-fly subtree reconfiguration without recompiling or restarting.

Inspired by the architectural maturity of Python's logging module and enterprise log routers like SLF4J, logd was designed from the ground up as an enabling tool: a high-performance, modular system design capable of handling real-world complexity without compromising runtime speed.

Architectural Principles
  • Zero-Jank Discipline: Heavy string formatting, ANSI styling, and disk I/O belong on background worker isolates, never on the main event loop.
  • Declarative Taxonomy: Subsystems are governed hierarchically with dot notation (app.network.auth) and resolve via an invalidated resolution cache.
  • Ambient Scopes: Transaction context flows seamlessly through Dart Zones without polluting function signatures or class constructors.
  • Dual Audience: Beautiful, compact ANSI tables for human engineers; schema-first TOON notation for autonomous AI triage agents.
02 // RUNTIME SPECIMENS & CODE BENCHMARKS

Architectural Pillars & Code Anatomy

Inspect how logd provides declarative control, concurrency isolation, and token efficiency.

Subsystem Hierarchy & Runtime Reconfiguration
DART 3.x
import 'package:logd/logd.dart';

void main() {
  // 1. Establish an application-wide baseline at INFO
  Logger.configure('app', logLevel: LogLevel.info);

  // 2. Throttle high-frequency network polling to WARNING
  Logger.configure('app.network', logLevel: LogLevel.warning);

  // 3. Elevate authentication subsystem to TRACE for targeted inspection
  Logger.configure('app.network.auth', logLevel: LogLevel.trace);

  // 4. O(1) Subtree Pruning: Disable analytics entirely
  // Calls to disabled nodes exit immediately with ZERO allocations
  Logger.configure('app.analytics', enabled: false);

  // 5. Pattern-based wildcard matching across dynamic subsystems
  Logger.configurePattern('app.cache.*', logLevel: LogLevel.error);
}

Dynamic Resolution with LoggerCache

In complex architectures with hundreds of loggers, evaluating inheritance policies on every log call introduces unacceptable overhead.

logd backs its dot-separated namespaces with an internal resolution cache (LoggerCache). When policies are updated at runtime—via an admin command, debug drawer, or network signal—only the targeted node and its descendants are invalidated.

O(1)Disabled subtree short-circuit before string interpolation or object allocation occurs.
03 // ISOLATE BENCHMARKS & CONCURRENCY

Visual Schematics & Engineering Benchmarks

Diagrams illustrating policy inheritance, isolate concurrency boundaries, stack trace demangling, and token optimization.

Figure 1 · Topology

Hierarchy Cascade & Resolution Flow

logd Architecture Flow Map

Hierarchical dot-notation delegation: parent policies cascade downward until overridden. The internal LoggerCache maintains O(1) resolution without per-event traversal.

Figure 2 · Concurrency

120Hz Zero-Jank Frame Budget Timeline

120Hz Zero-Jank Timeline

Comparing synchronous main-thread logging (which blocks the UI event loop and causes frame drops) against background isolate worker dispatch that protects the 8.3ms frame budget.

Figure 3 · Ergonomics

Smart Stack Trace Demangling

Smart Stack Trace Demangling

Collapses dozens of framework-internal frames (e.g., Flutter rendering and pipeline bindings), immediately directing developer attention to user package call-sites and structured IR table nodes.

Figure 4 · AI Telemetry

TOON vs JSON Token Benchmark

TOON Token Comparison

Empirical token comparison: TOON schema headers + tab-separated values dramatically compress structured logs, allowing LLM triage agents to analyze significantly larger telemetry batches.

04 // SATELLITE PACKAGES

A Lean Core with Specialized Satellites

Respecting low-level system hygiene: the core library carries zero external network or database dependencies. Specialization is packaged as clean satellites.

Core Package ↗

package:logd

Core Engine & Hierarchy Tree

Lightweight foundation, namespace inheritance, LoggerCache resolution, and intermediate representation (IR) nodes. Zero external dependencies.

AI TELEMETRY ↗

package:logd_toon

Token-Optimized Telemetry for LLMs

Tab-Oriented Object Notation formatter. Emits schema-first tab-delimited streams saving 30-50% prompt tokens for AI triage agents.

NETWORK ↗

package:logd_dio

HTTP Traffic Interception

Dio networking interceptor with sensitive credential redaction, sub-millisecond timing metrics, and automatic cURL command reproduction.

STORAGE ↗

package:logd_sqlite

WAL-Mode Embedded Persistence

ACID local database sink operating in SQLite WAL mode with embedded query introspection and automated table rotations.

DEV SERVER ↗

package:logd_network

Real-Time WebSocket Server & UI

Embedded local HTTP/WebSocket daemon serving an interactive browser-based inspection dashboard during development.

REPORTERS ↗

package:logd_html & logd_markdown

Automated Document Synthesis

Generates structured HTML session dossiers and Markdown summaries for CI/CD test reports and crash triage archives.

05 // QUICKSTART IMPLEMENTATION

Quickstart Implementation

Terminal · Add Dependency
dart pub add logd
Minimal Bootstrap
import 'package:logd/logd.dart';

void main() {
  // 1. Configure baseline isolate handler
  Logger.configure('app', handlers: [ConsoleHandler.async()]);

  // 2. Obtain logger instance
  final log = Logger.get('app.runtime');
  log.info('System initialized', context: {'status': 'operational'});
}
06 // RELATED WRITINGS & ARCHIVE
Vim navigation disabled. Press Alt+V or click to enable.Vim off (tap to enable)
Top