LogScope class

Lightweight logging handle bound to a scope name and controller.

All logging goes through LogScope. It does not know about outputs — it only submits records to the LogController which handles filtering and routing.

Constructors

LogScope(LogController _controller, String name, {String? tag, Map<String, Object>? boundData, String? traceId, String? requestId, String? parentSpanId, DateTime clock()?})
Creates a LogScope bound to _controller with the given name.

Properties

hashCode int
The hash code for this object.
no setterinherited
isDebug bool
Whether debug-level records pass the current filter.
no setter
isInternal bool
Whether internal-level records pass the current filter.
no setter
isTrace bool
Whether trace-level records pass the current filter.
no setter
name String
Scope name (e.g. 'rpc.transport.router').
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tag String?
Optional tag for sub-categorization.
final

Methods

child(String childName, {String? tag}) LogScope
Create a child scope with a dot-separated name.
debug(String message, {Map<String, Object>? data}) → void
Log at RpcLogLevel.debug level.
error(String message, {Object? error, StackTrace? stackTrace, Map<String, Object>? data}) → void
Log at RpcLogLevel.error level with optional error and stack trace.
fatal(String message, {Object? error, StackTrace? stackTrace, Map<String, Object>? data}) → void
Log at RpcLogLevel.fatal level with optional error and stack trace.
info(String message, {Map<String, Object>? data}) → void
Log at RpcLogLevel.info level.
internal(String message, {Map<String, Object>? data}) → void
Log at RpcLogLevel.internal level.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
startSpan(String spanName, {Map<String, Object>? data, String? traceId}) LogSpanHandle
Start a span. Must be ended explicitly via LogSpanHandle.end.
toString() String
A string representation of this object.
inherited
trace(String message, {Map<String, Object>? data}) → void
Log at RpcLogLevel.trace level.
warning(String message, {Object? error, StackTrace? stackTrace, Map<String, Object>? data}) → void
Log at RpcLogLevel.warning level with optional error and stack trace.
withContext({String? traceId, String? requestId}) LogScope
Create a new scope with RPC context (traceId, requestId).
withData(Map<String, Object> data) LogScope
Create a new scope with additional bound data fields. These fields are automatically merged into every record.
withSpan<T>(String spanName, Future<T> body(LogSpanHandle span), {Map<String, Object>? data}) Future<T>
Run body inside a span. Auto-ends with ok on return, error on throw.
withSpanSync<T>(String spanName, T body(LogSpanHandle span), {Map<String, Object>? data}) → T
Synchronous version of withSpan.
withTag(String tag) LogScope
Create a new scope with a different tag.

Operators

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

Static Properties

noop LogScope
No-op logger. All methods are empty, zero cost.
final