main.go 592 B

12345678910111213141516171819202122232425262728293031
  1. package main
  2. import (
  3. "context"
  4. "log/slog"
  5. "git.dmitriygnatenko.ru/dima/go-common/logger"
  6. )
  7. func main() {
  8. err := logger.Init(logger.NewConfig(
  9. logger.WithStdoutLogAddSource(true),
  10. logger.WithStdoutLogEnabled(true),
  11. logger.WithFileLogLevel(slog.LevelError),
  12. logger.WithEmailLogEnabled(true),
  13. logger.WithFileLogEnabled(true),
  14. logger.WithFileLogFilepath("test_log.txt"),
  15. ))
  16. _ = err
  17. ctx := context.Background()
  18. ctx = logger.With(ctx, "test111", 74658743)
  19. logger.InfoKV(ctx, "dfgdgdfgdssg", "dsfsd", "val333", "dfgdf", 11)
  20. // logger.Error(ctx, "dsfdsf dsf dsfs")
  21. }