AnsiLogger class

Ansi logger that prints log records into the console

Inheritance
Mixed in types

Constructors

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

Properties

decoration List<LogDecorator>
returns a list of LogDecorator functions.
final
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.
final
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
final
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
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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.
inherited
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.
inherited
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.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
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.
override
toString() String
A string representation of this object.
inherited

Operators

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

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