WIP: Add testcase && hook logger for server #360

Closed
devstigneev wants to merge 1 commits from devstigneev/micro:log_hooks into v3
Member

Pull Request template

Please, go through these steps before clicking submit on this PR.

  1. Give a descriptive title to your PR.
  2. Provide a description of your changes.
  3. Make sure you have some relevant tests.
  4. Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if applicable).

PLEASE REMOVE THIS TEMPLATE BEFORE SUBMITTING

## Pull Request template Please, go through these steps before clicking submit on this PR. 1. Give a descriptive title to your PR. 2. Provide a description of your changes. 3. Make sure you have some relevant tests. 4. Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes (if applicable). **PLEASE REMOVE THIS TEMPLATE BEFORE SUBMITTING**
devstigneev added 1 commit 2024-11-24 01:16:28 +03:00
Add testcase && hook logger for server
Some checks failed
lint / lint (pull_request) Has been cancelled
pr / test (pull_request) Has been cancelled
f33dcd628a
devstigneev changed title from Add testcase && hook logger for server to WIP: Add testcase && hook logger for server 2024-11-24 01:16:41 +03:00
devstigneev reviewed 2024-11-24 01:18:35 +03:00
@ -238,0 +244,4 @@
if err := log.Init(); err != nil {
t.Fatal(err)
}
log = log.Fields("key", "val")
Author
Member

Fields просто прокидываются в handler

Если использовать опцию WithFields они будут склонированы, тк хранятся в самой опции

Fields просто прокидываются в handler Если использовать опцию WithFields они будут склонированы, тк хранятся в самой опции
devstigneev reviewed 2024-11-24 01:20:59 +03:00
@ -238,0 +246,4 @@
}
log = log.Fields("key", "val")
nlog := log.Clone(logger.WithLevel(logger.InfoLevel))
Author
Member

метод клон, аналогичен методу филдс

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

https://git.unistack.org/devstigneev/micro/src/branch/log_hooks/logger/slog/slog.go#L130

метод клон, аналогичен методу филдс причина: аттррибуты пишутся только в сам хендлер слога, которые уже не копируются [https://git.unistack.org/devstigneev/micro/src/branch/log_hooks/logger/slog/slog.go#L130]()
Owner

поправил в v3.10.102

поправил в v3.10.102
vtolstov closed this pull request 2024-11-24 15:48:21 +03:00
Some checks failed
lint / lint (pull_request) Has been cancelled
pr / test (pull_request) Has been cancelled

Pull request closed

Sign in to join this conversation.
No description provided.