LogRecord class
An immutable snapshot of a log event passed to ChirpWriters.
You typically don't create LogRecords directly. They are created by
ChirpLogger when you call logging methods like Chirp.info().
LogRecord is primarily consumed when implementing custom ChirpWriters or formatters that need to access the full log context.
- Available extensions
Constructors
-
LogRecord({required Object? message, required DateTime timestamp, required DateTime wallClock, Zone? zone, ChirpLogLevel level = ChirpLogLevel.info, Object? error, StackTrace? stackTrace, Object? instance, StackTrace? caller, int? skipFrames, String? loggerName, Map<
String, Object?> ? data, List<FormatOptions> ? formatOptions}) - Creates a log record.
Properties
- caller → StackTrace?
-
The stacktrace of the log method call
final
- callerInfo → StackFrameInfo?
-
Available on LogRecord, provided by the LogRecordExt extension
Extracts caller info from this record's stack traceno setter -
copyWith
→ LogRecord Function({StackTrace? caller, Map<
String, Object?> ? data, Object? error, List<FormatOptions> ? formatOptions, Object? instance, ChirpLogLevel? level, String? loggerName, Object? message, int? skipFrames, StackTrace? stackTrace, DateTime? timestamp, DateTime? wallClock, Zone? zone}) -
Creates a copy of this LogRecord with the given fields replaced.
no setter
-
data
→ Map<
String, Object?> -
Structured data (key-value pairs) for machine-readable logging
final
- error → Object?
-
Optional error/exception
final
-
formatOptions
→ List<
FormatOptions> ? -
Format options for this specific log entry
final
- formattedTime → String
-
Available on LogRecord, provided by the LogRecordExt extension
Returns formatted time string like "HH:mm:ss.mmm"no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- instance → Object?
-
Original instance that logged this
final
- instanceHash → int?
-
Available on LogRecord, provided by the LogRecordExt extension
Returns the identity hash code of the instance, if present.no setter - level → ChirpLogLevel
-
Log severity level
final
- loggerName → String?
-
Logger name (for named loggers)
final
- message → Object?
-
The log message
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- skipFrames → int?
-
Number of stack frames to skip when resolving caller info
final
- stackTrace → StackTrace?
-
Optional stack trace
final
- timestamp → DateTime
-
When this log was created (from injectable
clock).final - wallClock → DateTime
-
The actual wall-clock time when this log was created.
final
- zone → Zone
-
The Zone that was active when this log was created.
final
Methods
-
instanceLabel(
) → String? -
Available on LogRecord, provided by the LogRecordExt extension
Returns a formatted instance identifier like "ClassName@a1b2" -
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