LogScope class

A scoped operation. Scopes form a tree - every scope has a parent except the root scope.

A scope begins with LogWriter.openScope and ends with LogWriter.closeScope. Log entries within the scope reference it via LogEntry.scope.

Constructors

LogScope({required String id, required String label, required DateTime startTime, LogScope? parent, Map<String, Object?>? metadata})
Creates a scope. Prefer LogScope.root or child over calling this directly.
const
LogScope.root(String label)
Creates a root scope for a process.
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
id String
Stable identifier for this scope. Unique within a process lifetime; referenced by LogEntry.scope and by scope open/close events.
final
label String
Human-readable label describing the scoped operation.
final
metadata Map<String, Object?>?
Optional scope-level structured metadata (arbitrary key/value pairs).
final
parent LogScope?
Enclosing scope, or null if this is a root scope.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
startTime DateTime
Wall-clock time at which the scope was opened.
final

Methods

child({required String id, required String label, Map<String, Object?>? metadata}) LogScope
Creates a child scope under this scope.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

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