From 06ff90ba8c1dfa03b41d2bdbf021f4af5d6c6ce8 Mon Sep 17 00:00:00 2001 From: Hans Kokx Date: Thu, 12 Sep 2024 11:14:21 +0200 Subject: [PATCH] Simplified logger example Signed-off-by: Hans Kokx --- README.md | 52 +++------------------------------------------------- pubspec.yaml | 2 +- 2 files changed, 4 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index 96e0b9e..fc44dcf 100644 --- a/README.md +++ b/README.md @@ -181,55 +181,9 @@ class DebugConsole implements LoggingInterface { Level? level, StackTrace? stackTrace, }) { - if (Feature.logging.disabled) return; - if (Feature.debugConsoleLogging.disabled) return; - - final Map localMetadata = metadata ?? {}; - - final String? module = localMetadata["module"] as String?; - final String? method = localMetadata["method"] as String?; - - const JsonEncoder encoder = JsonEncoder.withIndent(" "); - final String? prettyprint = - (localMetadata.isNotEmpty) ? encoder.convert(localMetadata) : null; - - final Logger logger = Logger( - level: level, - printer: PrettyPrinter( - methodCount: 2, - errorMethodCount: kDebugMode && - !(level == Level.error || - level == Level.warning || - level == Level.trace || - level == Level.fatal) - ? 4 - : 8, - stackTraceBeginIndex: 1, - lineLength: 120, - colors: !Platform.isIOS, - printEmojis: kDebugMode, - dateTimeFormat: DateTimeFormat.none, - ), - ); - - // Print the message to the debug console - String prefix = ""; - if (module != null) prefix += "[$module]"; - if (method != null) prefix += "[$method]"; - if (prefix.isNotEmpty) prefix += " "; - message = "$prefix$message"; - - if (prettyprint.isNotNullOrEmpty) message += "\n\n$prettyprint"; - - localMetadata.removeWhere((key, value) => key == "module"); - localMetadata.removeWhere((key, value) => key == "method"); - localMetadata.removeWhere((key, value) => key == "filenameAndLineNumber"); - - logger.log( - level ?? Level.debug, - message, - error: localMetadata["error"] ?? "", - stackTrace: stackTrace, + debugPrint( + "$message\n" + "$metadata\n" ); } diff --git a/pubspec.yaml b/pubspec.yaml index 0c73b50..fea6ae0 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: arcane_framework description: "The Arcane Framework provides a modular, feature-rich solution for bootstrapping new applications." -version: 1.0.1 +version: 1.0.1+1 repository: https://github.com/hanskokx/arcane_framework issue_tracker: https://github.com/hanskokx/arcane_framework/issues