Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What if I don't use zap?

Ideally you want to add an option via a function or interface:

  func New(optOne bool, log func(string, ...any)) {
    if log == nil {
        log = func(m string, a ...any) { fmt.Printf(m, a...) }
    }
    log("starting; optOne=%v", optOne)
  }
Or something along those lines.


This is what log/slog is for!


What if I don't use slog?


Change and use slog with the zap adapter




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: