Skip to content

Client logs#447

Open
t33nsy wants to merge 3 commits intomasterfrom
258_client_log
Open

Client logs#447
t33nsy wants to merge 3 commits intomasterfrom
258_client_log

Conversation

@t33nsy
Copy link
Collaborator

@t33nsy t33nsy commented Dec 5, 2025

No description provided.

@t33nsy t33nsy linked an issue Dec 5, 2025 that may be closed by this pull request
Copy link
Collaborator

@HadronCollider HadronCollider left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • нужно добавить логи для "базовые состояния, действия", как минимум в рамках проведения тренировки (нажал кнопку / загрузил презентацию / переключил слайд / пр.)
  • логи необходимо "связать" с соответствующей тренировкой (=хотя бы добавить id в строку)

Comment on lines +107 to +112
frame = inspect.currentframe() # кадр
caller = frame.f_back # кадр вызывающей функции
pathname = caller.f_code.co_filename # путь к файлу вызвывающей функции
filename = pathname.split('/')[-1] # имя файла
funcName = caller.f_code.co_name # имя функции
lineno = caller.f_lineno # номер строки
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если мы сохраняем логи с клиента - какой смысл в этих данных от бэкенд-файла?
Может, если хотите сохранить "путь" к месту логов, разумнее там держать информацию с фронта (файл, функции, строки и пр. - аналогичная информация, откуда пришли логи)?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Отформатируйте файл

trainingId,
currentPage;

function waitForLogger(callback, timeout = 3000) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

В чем смысл waitForLogger? При этом он используется только на этой странице (и то не везде) - на других страницах не нужно его ожидать?




@api_logs.route('/api/logs/', methods=['GET'])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Проверьте, чтобы на странице http://localhost:5000/api/logs/ - была информация о тренировке

return logs_json, 200


@api_logs.route('/logs', methods=['POST'])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Добавьте вывод логов в консоль (также как выводятся логи от бэкенда) - это позволит просматривать логи из всех источников в одном месте (и более доступном, чем БД)

Возможно стоит даже доработать логгер бэкенда (вынесите в отдельную задачу и назначьте на себя) - чтобы он своим вызовом печатал в консоль и сохранял в БД (без лишних вызовов и прочего)

},
body: JSON.stringify({
timestamp: new Date().toISOString(),
message: args.join(' '),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Добавьте trainingId и в сообщение

Comment on lines +7 to +12
(function () {

// const trainingId =
// window.APP_CONTEXT?.trainingId ?? null;

class Logger {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Если подобный ход ((function () {...})()) сделан для запуска на этапе загрузке страницы (или после её загрузки) - лучше поменять на что-то более приличное (addEventListener или подобное)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Клиентские логи

3 participants