publish method
void
publish()
Publishes all logs to the console.
This method iterates through all log levels and their associated messages, and publishes them to the console if canPublish is false.
Example:
logger.publish();
This is mostly used when the extending class was initially created with canPublish set to false.
Implementation
void publish() {
if(canPublish.isFalse) {
if(_logs.isNotEmpty) {
_logs.forEach((LogLevel level, _LogFactoryDetails details) {
details.forEach((timestamp, content) {
_log(level, getMessage(content), error: getError(content), stacktrace: getStackTrace(content));
});
});
}
if(_superEntry.isNotEmpty) {
_superEntry.forEach((tag, details) {
details.forEach((level, updates) {
updates.forEach((timestamp, content) {
_log(level, getMessage(content), dTag: tag, error: getError(content), stacktrace: getStackTrace(content));
});
});
});
}
clear();
}
}