JsonFormatter class final

JsonFormatter is used to encode Record to JSON format.

Make sure that no fields with overlapping names are provided as formatter de-duplicates collapsing fields, i.e. providing fields with the same key results only to a single field is include into the output.

As such we strongly recommend not to put fields in to any collections fields with key such as level, message, name and timestamp.

Mixed-in types

Constructors

JsonFormatter({LevelFormatter<Object> formatLevel = _formatLevel, TimestampFormatter<Object> formatTimestamp = _formatTimestamp})
Creates a new JsonFormatter.
factory
JsonFormatter.withDefaults()
Creates a new JSONFormatter with default configurations.
factory

Properties

formatLevel LevelFormatter<Object>
final
formatTimestamp TimestampFormatter<Object>
final
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

call(Record record) List<int>
getFieldFormatter(FieldKind kind) → FieldFormatter<MapEntry<String, Object?>>
Returns registered formatter for a give field kind.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
setFieldFormatter(FieldKind kind, FieldFormatter<MapEntry<String, Object?>> formatter) → void
Registers formatter for a given field kind.
inherited
toString() String
A string representation of this object.
inherited

Operators

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