From 6cb1defd7fa98a74b2e24370c004367c994a9ad2 Mon Sep 17 00:00:00 2001 From: Covalent <58121030+lukehmcc@users.noreply.github.com> Date: Tue, 3 Jun 2025 14:21:16 -0400 Subject: [PATCH] Create minimal.dart --- lib/src/node/logger/minimal.dart | 40 ++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 lib/src/node/logger/minimal.dart diff --git a/lib/src/node/logger/minimal.dart b/lib/src/node/logger/minimal.dart new file mode 100644 index 0000000..03d4d75 --- /dev/null +++ b/lib/src/node/logger/minimal.dart @@ -0,0 +1,40 @@ +import 'base.dart'; +// Quick change of: https://github.com/s5-dev/lib5/blob/main/lib/src/node/logger/simple.dart +// Supresses spammy warns when those aren't wanted +class MinimalLogger extends Logger { + final String prefix; + final bool format; + final bool showVerbose; + + MinimalLogger({ + this.prefix = '', + this.format = true, + this.showVerbose = false, + }); + + @override + void info(String s) { + print(prefix + s.replaceAll(RegExp('\u001b\\[\\d+m'), '')); + } + + @override + void error(String s) { + print('$prefix[ERROR] $s'); + } + + @override + void verbose(String s) { + if (!showVerbose) return; + print(prefix + s); + } + + @override + void warn(String s) { + // Silent - no output + } + + @override + void catched(e, st, [context]) { + // Silent - no output + } +}