Skip to content
This repository has been archived by the owner on Aug 25, 2021. It is now read-only.

Add logger #12

Merged
merged 7 commits into from
Jan 18, 2019
Merged

Add logger #12

merged 7 commits into from
Jan 18, 2019

Conversation

Kirguir
Copy link
Contributor

@Kirguir Kirguir commented Jan 15, 2019

Add function(s) for configure output and level logger.

@Kirguir
Copy link
Contributor Author

Kirguir commented Jan 15, 2019

@alexlapa нам по идее надо только сконфигурировать логгер - куда выводить, в каком виде, дефолтные ключи.
Потом с помощью 'slog_scope' устанавливаем его как глобальный, а где нужно с помощью того же scope можем добавить нужные ключи.
Или предполагается другой вариант - передавать логгер явно как зависимость, так же как в Go?

  • в каком формате выводим лог, какие ключи?
  • нужен ли dual logger, с разделением по уровням - инфо отдельно, ошибки отдельно?

@Kirguir Kirguir self-assigned this Jan 15, 2019
@Kirguir Kirguir added feature New feature or request k::logging Related to application logs labels Jan 15, 2019
@Kirguir Kirguir added this to the 0.1.0 milestone Jan 15, 2019
@alexlapa alexlapa mentioned this pull request Jan 15, 2019
16 tasks
@alexlapa
Copy link
Collaborator

alexlapa commented Jan 15, 2019

@Kirguir ,

Пока логгер нужен просто для дебага во время разработки, поэтому предлагаю ограничиться необходимым минимумом.

Уровни: DEBUG, INFO, WARN, ERROR. Первые два в STDOUT, вторые два в STDERR.
Формат - json, ключи: level, timestamp, msg.

передавать логгер явно как зависимость, так же как в Go?

Давайте просто глобальный.

@Kirguir
Copy link
Contributor Author

Kirguir commented Jan 15, 2019

@alexlapa вот такой вариант. 'main' потом вычищу. Уровни логирования настраиваются в cargo.toml Тесты, CHANGELOG нужно?

@alexlapa
Copy link
Collaborator

@Kirguir ,

CHANGELOG обязателен. Тут пока без тестов обойдемся.

@tyranron
Copy link
Member

@Kirguir @alexlapa CHANGELOG can be skipped for now as we have no version at the moment. We will fill it after 0.1 is released to describe the changes between 0.1 and 0.2, and so on...

@Kirguir
Copy link
Contributor Author

Kirguir commented Jan 16, 2019

@alexlapa FCM

Implement application logger (!12, #10)

@Kirguir Kirguir requested a review from alexlapa January 16, 2019 09:35
@alexlapa
Copy link
Collaborator

@Kirguir ,

Как пробросить желаемый уровень логирования?

@Kirguir
Copy link
Contributor Author

Kirguir commented Jan 17, 2019

@alexlapa В Cargo.toml - первый для dev окружения, второй для release:

slog = { version = "2.4", features = ["max_level_info", "release_max_level_warn"] }

отсюда

@alexlapa alexlapa requested a review from tyranron January 18, 2019 05:44
Copy link
Member

@tyranron tyranron left a comment

Choose a reason for hiding this comment

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

I corrected the stuff below, but pay attention.

Cargo.toml Outdated Show resolved Hide resolved
src/log/mod.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
@Kirguir Kirguir changed the title WIP: Add logger Add logger Jan 18, 2019
@Kirguir Kirguir merged commit 7b7fa5b into master Jan 18, 2019
@Kirguir Kirguir deleted the add_logger branch January 18, 2019 10:53
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature New feature or request k::logging Related to application logs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants