mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-07-08 01:30:28 +08:00
Update log format
This commit is contained in:
@@ -76,7 +76,7 @@ class LogsFile {
|
|||||||
|
|
||||||
bool log(LogRecord record) {
|
bool log(LogRecord record) {
|
||||||
final stack = record.stackTrace != null ? '\n${record.stackTrace}' : '';
|
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 t = record.time;
|
||||||
final hour = t.hour.toString().padLeft(2, '0');
|
final hour = t.hour.toString().padLeft(2, '0');
|
||||||
final minute = t.minute.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 millisecond = t.millisecond.toString().padLeft(3, '0');
|
||||||
final time = "$hour:$minute:$second.$millisecond";
|
final time = "$hour:$minute:$second.$millisecond";
|
||||||
final logText =
|
final logText =
|
||||||
'${record.level.name}: ${record.loggerName}: $time: ${record.message}$error$stack';
|
'$time: ${record.level.name}: ${record.loggerName}: ${record.message}$error$stack';
|
||||||
try {
|
try {
|
||||||
final file = _file(record.time);
|
final file = _file(record.time);
|
||||||
if (file == null) {
|
if (file == null) {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ void defaultLogger(LogRecord record) {
|
|||||||
final error = record.error != null ? '${record.error}' : '';
|
final error = record.error != null ? '${record.error}' : '';
|
||||||
// ignore: avoid_print
|
// ignore: avoid_print
|
||||||
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 {
|
Future<void> initLogger() async {
|
||||||
|
|||||||
Reference in New Issue
Block a user