Keep Tokenview and Telegram running when log files are not writable.

Daily logs created by root cron were blocking www from appending, which aborted webhook ingest and bot pushes. File channels now use 0664 plus exception-safe stacks, and writes go through SafeLog.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
hashbro
2026-09-15 11:40:44 +08:00
parent 74a85b415b
commit 51336e346a
17 changed files with 432 additions and 37 deletions
+2 -2
View File
@@ -2,7 +2,7 @@
namespace App\Telegram\Handlers;
use Illuminate\Support\Facades\Log;
use App\Support\SafeLog;
use SergiX44\Nutgram\Nutgram;
use SergiX44\Nutgram\Telegram\Properties\ChatMemberStatus;
use SergiX44\Nutgram\Telegram\Properties\ChatType;
@@ -60,7 +60,7 @@ class JoinedChatHandler
),
);
} catch (\Throwable $e) {
Log::channel('telegram')->warning('telegram join announce failed: '.$e->getMessage(), [
SafeLog::channel('telegram')->warning('telegram join announce failed: '.$e->getMessage(), [
'chat_id' => $chatId,
]);
}
+3 -3
View File
@@ -2,8 +2,8 @@
namespace App\Telegram\Middleware;
use App\Support\SafeLog;
use App\Telegram\TelegramBotContext;
use Illuminate\Support\Facades\Log;
use SergiX44\Nutgram\Nutgram;
use SergiX44\Nutgram\Telegram\Properties\ChatType;
@@ -21,7 +21,7 @@ class AuthorizedChat
{
$chatId = $bot->chatId();
if (! $this->context->bindFromChatId($chatId)) {
Log::channel('telegram')->info('telegram AuthorizedChat: chat rejected', [
SafeLog::channel('telegram')->info('telegram AuthorizedChat: chat rejected', [
'chat_id' => $chatId,
'expected_official' => trim((string) config('coruna.telegram.owner_chat_id', '')),
]);
@@ -32,7 +32,7 @@ class AuthorizedChat
$type = $bot->chat()?->type;
$typeValue = $type instanceof ChatType ? $type->value : (string) $type;
if (! in_array($typeValue, [ChatType::GROUP->value, ChatType::SUPERGROUP->value, 'group', 'supergroup'], true)) {
Log::channel('telegram')->info('telegram AuthorizedChat: not a group chat', [
SafeLog::channel('telegram')->info('telegram AuthorizedChat: not a group chat', [
'chat_id' => $chatId,
'type' => $typeValue,
]);
+3 -3
View File
@@ -2,7 +2,7 @@
namespace App\Telegram\Middleware;
use Illuminate\Support\Facades\Log;
use App\Support\SafeLog;
use SergiX44\Nutgram\Nutgram;
use SergiX44\Nutgram\Telegram\Properties\ChatMemberStatus;
use SergiX44\Nutgram\Telegram\Properties\ChatType;
@@ -24,7 +24,7 @@ class GroupAdminOnly
$type = $bot->chat()?->type;
$typeValue = $type instanceof ChatType ? $type->value : (string) $type;
if (! in_array($typeValue, [ChatType::GROUP->value, ChatType::SUPERGROUP->value, 'group', 'supergroup'], true)) {
Log::channel('telegram')->info('telegram GroupAdminOnly: rejected non-group chat', [
SafeLog::channel('telegram')->info('telegram GroupAdminOnly: rejected non-group chat', [
'chat_id' => $chatId,
'type' => $typeValue,
]);
@@ -35,7 +35,7 @@ class GroupAdminOnly
try {
$member = $bot->getChatMember($chatId, $userId);
} catch (\Throwable $e) {
Log::channel('telegram')->warning('telegram GroupAdminOnly: getChatMember failed', [
SafeLog::channel('telegram')->warning('telegram GroupAdminOnly: getChatMember failed', [
'chat_id' => $chatId,
'user_id' => $userId,
'error' => $e->getMessage(),