entry property
_LogFactoryEntry
get
entry
Returns the log entry for the current logger.
This is mostly used when combining multiple loggers, in order to keep track of logs per tags.
A base class for building structured logging mechanisms within Jet-based applications.
This class provides an in-memory logging facility with support for multiple LogLevels. Subclasses can extend this base to implement custom logging strategies (e.g., file, console, remote).
Each logger instance is tagged with a custom tag to allow filtering or identification in composite logs.
Usage
Extend this class to build a concrete logger:
class ConsoleLogger extends LoggerFactory {
ConsoleLogger(String tag) : super(tag);
void flush() {
_logs.forEach((level, messages) {
for (final message in messages) {
print('[$tag][$level] $message');
}
});
}
}
Then use:
final logger = ConsoleLogger("MyService");
logger.add(LogLevel.info, "Service started.");
logger.add(LogLevel.error, "Something went wrong.");
logger.flush();
Implementation
_LogFactoryEntry get entry => {tag: _logs};