SpringLogRecord class final
One logged message with everything known about it, as a log handler receives it.
Applications receive records when they write a SpringLogHandler (to send logs elsewhere) or SpringLog.listen (to capture logs in a test or show them on a screen). A record cannot change and carries what a console line or a log viewer needs: time, a unique increasing sequence (a stable list key), level, loggerName, message, structured fields and the error with its stackTrace.
// Hand every record to a logging package the application already uses.
SpringLog.handler = (record) =>
myLogger.log(record.level.name, record.message, record.error);
Constructors
-
SpringLogRecord(SpringLogLevel level, String loggerName, String message, {Object? error, StackTrace? stackTrace, Map<
String, Object?> fields = const {}, DateTime? time, int? sequence}) -
Creates a record of
levelfrom the loggerloggerName.timedefaults to now andsequenceto the next number; loggers create records, tests sometimes do.
Properties
- error → Object?
-
The error that caused the message, or
null.final -
fields
→ Map<
String, Object?> -
Structured data for search and filtering, such as an order id: the
SpringLog.withFields context of the caller merged with the fields
passed to the log call (like SLF4J's MDC and key-value pairs). Empty
when there are none, never
null.final - hashCode → int
-
The hash code for this object.
no setterinherited
- level → SpringLogLevel
-
How important the message is.
final
- loggerName → String
-
The name of the logger that logged it, such as
spring_core_dart.beans.final - message → String
-
The text of the message, already built.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sequence → int
-
A number that grows with every record, unique within the process.
final
- stackTrace → StackTrace?
-
The stack trace of error, or
null.final - time → DateTime
-
When the message was logged.
final
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited