Update log format

This commit is contained in:
2023-08-31 15:08:50 +08:00
parent 252b1c018d
commit 45fb64f4af
2 changed files with 3 additions and 3 deletions

View File

@@ -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) {

View File

@@ -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<void> initLogger() async {