For test purposes now I have this configuration of zapLogger with writing to "errors.log". In test I read the file, compare some needed texts and delete it when test is finished.
l := logger.New(zap.Config{Level: level, Encoding: "json", OutputPaths: []string{"errors.log"}}).
With(zap.String("app-env", cfg.APP.Environment), zap.String("app-version", cfg.APP.Version))
//reading logs in different file...
data, _ := os.ReadFile("errors.log")
actual := string(data)
Is it possible to do that without creating file and reading from the os.Stdout or saving logs to buffer? I tried several times but with no luck.
What should I change here to be able to read logs in my test without creating a file?