Skip to main content

LogModel

Represents a structured log event passed to sinks.

Properties

PropertyTypeDescription
tStringISO-8601 timestamp (@t in CLEF)
mtStringMessage template (@mt)
levelStringLevel name (@l)
dataMap<String, dynamic>?Structured properties

Constructor

LogModel({
required String mt,
String level = "debug",
Map<String, dynamic>? data,
String t = "",
})

If t is empty, the current timestamp (DateTime.now().toIso8601String()) is assigned automatically.

Serialization

toMap()

Map<String, dynamic> toMap()

Returns:

{
'@t': t,
'@mt': mt,
'@l': level,
'data': data,
}

fromMap

factory LogModel.fromMap(Map<String, dynamic> map)

Rebuilds a LogModel from a map produced by toMap().