From 45fb64f4af0dbb76e396bd8457bb8dd947caeca2 Mon Sep 17 00:00:00 2001 From: lifegpc Date: Thu, 31 Aug 2023 15:08:50 +0800 Subject: [PATCH] Update log format --- lib/logs/file.dart | 4 ++-- lib/main.dart | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/logs/file.dart b/lib/logs/file.dart index 1a1f51a..9ee16ef 100644 --- a/lib/logs/file.dart +++ b/lib/logs/file.dart @@ -76,7 +76,7 @@ class LogsFile { bool log(LogRecord record) { final stack = record.stackTrace != null ? '\n${record.stackTrace}' : ''; - final error = record.error != null ? '${record.error}' : ''; + final error = record.error != null ? ' ${record.error}' : ''; final t = record.time; final hour = t.hour.toString().padLeft(2, '0'); final minute = t.minute.toString().padLeft(2, '0'); @@ -84,7 +84,7 @@ class LogsFile { final millisecond = t.millisecond.toString().padLeft(3, '0'); final time = "$hour:$minute:$second.$millisecond"; final logText = - '${record.level.name}: ${record.loggerName}: $time: ${record.message}$error$stack'; + '$time: ${record.level.name}: ${record.loggerName}: ${record.message}$error$stack'; try { final file = _file(record.time); if (file == null) { diff --git a/lib/main.dart b/lib/main.dart index 1ec8228..79f0c85 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -35,7 +35,7 @@ void defaultLogger(LogRecord record) { final error = record.error != null ? '${record.error}' : ''; // ignore: avoid_print print( - '${record.level.name}: ${record.loggerName}: ${record.time}: ${record.message}$error$stack'); + '${record.time}: ${record.level.name}: ${record.loggerName}: ${record.message}$error$stack'); } Future initLogger() async {