Open
Description
When using absolute Windows paths, url.Parse does not retreieve the "file" scheme.
panic: couldn't open sink "C:\\Users\\...\\AppData\\Roaming\\...\\info.log.json": no sink found for scheme "c"
Appending, "file:///" (golang/go#6027 (comment)) does not work as expected. (Ref: golang/go#13276 )
Line 99 in ff33455
Ref: golang/go#13276 (comment)
Changed by PR: #606
Temporary workaround:
func newWinFileSink(u *url.URL) (zap.Sink, error) {
// Remove leading slash left by url.Parse()
return os.OpenFile(u.Path[1:], os.O_WRONLY|os.O_APPEND|os.O_CREATE, 0644)
}
zap.RegisterSink("winfile", newWinFileSink)
zap.Config{
OutputPaths: []string{"stdout", "winfile:///" + filepath.Join(GlobalConfigDir.Path, "info.log.json")},
}
Metadata
Assignees
Labels
No labels
Activity