JsonLogger constructor
JsonLogger({
- required int logLevel,
- RecordMapper? mapper,
- JsonSerializer? serializer,
- void output() = print,
The JsonLogger class is a logger that records log messages in JSON format.
It implements the ILogRecorder interface and provides the following features:
- supports configurable log levels.
- can be used to record log messages to any output stream, such as the console, a file, or a network socket.
- uses a customizable mapper to convert LogRecordEntity objects to JSON maps.
- uses a customizable serializer to serialize JSON maps to strings.
Implementation
JsonLogger({
required this.logLevel,
RecordMapper? mapper,
JsonSerializer? serializer,
this.output = print,
}) : mapper = mapper ?? _defaultMapper,
serializer = serializer ?? jsonEncode;