Skip to content

Logging#2

Open
MariaKhodorova wants to merge 2 commits intomainfrom
log
Open

Logging#2
MariaKhodorova wants to merge 2 commits intomainfrom
log

Conversation

@MariaKhodorova
Copy link
Copy Markdown
Owner

No description provided.

Copy link
Copy Markdown

@VolovikovAlexander VolovikovAlexander left a comment

Choose a reason for hiding this comment

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

Некорректная реализация шаблона "наблюдатель". Сделайте автотест. Проверьте работу. Запустите автотесты. Уверен, что у Вас тесту "упадут".

В целом, Вы на верном пути.

storage_observer.observers.append(self)

def handle_event(self, event: str):
event = event.split(' ')
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Некорректно. В handle_event нужно передавать ключ , а не набор данных.
Вы вызываете метод так

  storage_observer().raise_event(event_type.debug_log(), f"Добавлен новый элемент: (ID: {item.id}; NAME: {item.name})")

У Вас тут два параметра, а в обработчике - один
Более того, Ваш сервис будет все сообщения ловить (нет условия по ключу).

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants