AnsiLogger class

Ansi logger that prints log records into the console

Mixed in types


AnsiLogger({required bool preferPrintOverLog, required int logLevel, List<LogDecorator> decoration = const [], Adapter<LogRecordEntity, String> recordAdapter = defaultAdapter})
Ansi logger that prints log records into the console


decoration List<LogDecorator>
returns a list of LogDecorator functions.
hashCode int
The hash code for this object.
no setterinherited
logLevel int
The logLevel getter returns the log level of the log recorder instance. This log level represents the minimum level of logs that will be recorded by this recorder.
preferPrintOverLog bool
by default you can use log from developer package but you are unable to use this method in release mode this flag will make sure that you are able too see messages even in production mode
recordAdapter Adapter<LogRecordEntity, String>
as ansi logger only supports string we have to map the log record to string so by default we will only extract log-message but if you want to add a custom recordAdapter you can pass this parameter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited


canRecord(LogRecordEntity record) bool
validate whether the current log record should be recorded by the log recorder instance. By default, it checks if the log level of the log recorder is equal to or less than the log level of the given record parameter.
close() → void
called when this particular log recorder is removed from the manager. It serves as a cleanup or finalization method for any resources or operations associated with the log recorder.
decorate(String message, LogRecordEntity record) String
The decorate method is a method that receives a non-decorated log message as message and a LogRecordEntity object as record. It applies the decoration logic using the list of LogDecorator functions specified in the decoration property.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
onRecord(LogRecordEntity record) → void
a callback that will be invoked when the manager receives a new log record that can be recorded by this specific recorder. It takes a LogRecordEntity object as a parameter, representing the log record that was received.
toString() String
A string representation of this object.


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

Static Properties

addTrailingLevel bool
If true will add :{level} to logger name
getter/setter pair

Static Methods

defaultAdapter(LogRecordEntity record) String
default log record adapter that only returns the record.message