From 090abb06f2cf5094cc22ec9e69cc1c61c9a69481 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Thu, 11 Dec 2025 21:16:10 +0300 Subject: [PATCH] print --- mnemo_cards_telegram_bot/bin/main.dart | 27 +++++++++++++------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/mnemo_cards_telegram_bot/bin/main.dart b/mnemo_cards_telegram_bot/bin/main.dart index a09265b..c7c9cc4 100644 --- a/mnemo_cards_telegram_bot/bin/main.dart +++ b/mnemo_cards_telegram_bot/bin/main.dart @@ -1,4 +1,3 @@ -import 'dart:developer'; import 'dart:io'; import 'package:path/path.dart'; import 'package:mnemo_cards_telegram_bot/bot_config.dart'; @@ -93,7 +92,7 @@ Future _handleCodeClaim({ } Future _run() async { - log('Starting bot version $version'); + print('[BOT] Starting bot version $version'); BackendClient? backendClient; TeleDart? teledart; @@ -104,7 +103,7 @@ Future _run() async { final adminIds = lines.map((e) => e.trim()).toList(); if (adminIds.isEmpty) { - log('No admins found in admins file'); + print('[BOT] ERROR: No admins found in admins file'); return; } @@ -116,12 +115,12 @@ Future _run() async { try { await teledart!.sendMessage(admin, message); } catch (e) { - log('Failed to notify admin $admin', error: e); + print('[BOT] ERROR: Failed to notify admin $admin: $e'); } } } - log('Using backend API at ${config.backendUrl}'); + print('[BOT] Using backend API at ${config.backendUrl}'); backendClient = BackendClient( backendUrl: config.backendUrl, @@ -259,7 +258,7 @@ Future _run() async { } else { message.reply('Что-то пошло не так'); } - log('app error', error: e, stackTrace: s); + print('[BOT] ERROR: app error: $e\n$s'); } }); @@ -294,7 +293,7 @@ Future _run() async { teledartInstance.sendMessage(message.chat.id, 'Загрузка apk...'); message.replyDocument(file, caption: t.simpleString); } on Object catch (e, s) { - log('app error', error: e, stackTrace: s); + print('[BOT] ERROR: app error: $e\n$s'); message.reply(e.toString()); } } @@ -314,7 +313,7 @@ Future _run() async { answer.write('$type/$size - ok\n'); } catch (e, s) { answer.write('$type/$size - error\n'); - log('clear cache error $dir', error: e, stackTrace: s); + print('[BOT] ERROR: clear cache error $dir: $e\n$s'); } } else { answer.write('$type/$size - not exists\n'); @@ -359,7 +358,7 @@ Future _run() async { ); } } on Object catch (e, s) { - log('app error', error: e, stackTrace: s); + print('[BOT] ERROR: app error: $e\n$s'); message.reply(e.toString()); } } @@ -392,7 +391,7 @@ Future _run() async { ); } } on Object catch (e, s) { - log('app error', error: e, stackTrace: s); + print('[BOT] ERROR: app error: $e\n$s'); message.reply(e.toString()); } } @@ -437,7 +436,7 @@ Future _run() async { message.reply('No backups'); } } on Object catch (e, s) { - log('backup error', error: e, stackTrace: s); + print('[BOT] ERROR: backup error: $e\n$s'); message.reply(e.toString()); } } @@ -587,10 +586,10 @@ Future _run() async { }); teledartInstance.start(); - log('Bot started'); + print('[BOT] Bot started successfully'); } on Exception catch (e, s) { - log('Error: $e', error: e, stackTrace: s); - print('Error while starting bot: $e'); + print('[BOT] ERROR: Error: $e\n$s'); + print('[BOT] Error while starting bot: $e'); print('Stack trace: $s'); print(''); print('Required environment variables:');