MCPcopy Index your code
hub / github.com/apache/devlake / GetFileStream

Function GetFileStream

backend/impls/logruslog/stream.go:27–40  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

25)
26
27func GetFileStream(path string) (io.Writer, errors.Error) {
28 if path == "" {
29 return os.Stdout, nil
30 }
31 err := os.MkdirAll(filepath.Dir(path), 0777)
32 if err != nil {
33 return nil, errors.Convert(err)
34 }
35 file, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0644)
36 if err != nil {
37 return nil, errors.Convert(err)
38 }
39 return io.MultiWriter(os.Stdout, file), nil
40}

Callers 1

initFunction · 0.85

Calls 1

ConvertMethod · 0.45

Tested by

no test coverage detected