addAll method
void
addAll(
- _LogFactoryEntry entry
Adds all logs from the given entry
to the internal super entry buffer.
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
void addAll(_LogFactoryEntry entry) {
_superEntry.addAll(entry);
}