MCPLogger class

Logger for MCP UI Runtime that outputs debug messages.

In debug mode, uses dart:developer log for output. In release mode, logging is disabled by default to avoid performance impact.

A host that wants these must install onRecord. Everything else the runtime says goes to dart:developer, which reaches whoever has DevTools open and nobody else — and some of what it says is meant for the person writing the document, not for whoever is debugging the app. A warning that a theme role was declared and dropped is useless in a channel the author never looks at. stdout is not an option: on a stdio MCP connection it is the protocol.

Constructors

MCPLogger(String name, {bool? enableLogging})
MCPLogger.forClass(Type type, {bool? enableLogging})
Factory constructor for creating a logger with a specific name
factory

Properties

enableLogging bool
final
hashCode int
The hash code for this object.
no setterinherited
name String
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

debug(String message) → void
Log a debug message
error(String message, [Object? error, StackTrace? stackTrace]) → void
Log an error message
info(String message) → void
Log an info message
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
warning(String message) → void
Log a warning message

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Properties

onRecord ↔ void Function(MCPLogRecord record)?
Receives every record, in every build mode.
getter/setter pair