exportAll static method

Map<String, String> exportAll({
  1. bool export = true,
  2. bool onlyOnError = false,
})

Exports all tags to console as Markdown and returns them as a map.

Each tag is exported separately with its own separators. Returns a map where keys are tag names and values are the formatted Markdown strings. Returns empty map in release mode.

Parameters:

  • export: If false, clears all tags without exporting. Default: true.
  • onlyOnError: If true, only exports tags that have errors.

Example:

// Export everything and get results
final logs = Log.exportAll();

// Save all to files
for (final entry in logs.entries) {
  File('${entry.key}_log.md').writeAsStringSync(entry.value);
}

// Conditional export
Log.exportAll(export: shouldExportLogs);

// Only export tags with errors
Log.exportAll(onlyOnError: true);

Implementation

static Map<String, String> exportAll({
  bool export = true,
  bool onlyOnError = false,
}) {
  final results = <String, String>{};
  assert(() {
    for (final name in _tags.keys.toList()) {
      final content = Log.export(
        name,
        export: export,
        onlyOnError: onlyOnError,
      );
      if (content != null) {
        results[name] = content;
      }
    }
    return true;
  }());
  return results;
}