go_goutils/logging/funcs.go

21 lines
374 B
Go
Raw Normal View History

2021-02-26 15:52:29 -05:00
package logging
import (
2021-02-27 00:51:58 -05:00
"os"
2021-02-26 15:52:29 -05:00
)
2022-01-05 05:15:38 -05:00
// testOpen attempts to open a file for writing to test for suitability as a LogFile path.
2021-02-26 15:52:29 -05:00
func testOpen(path string) (success bool, err error) {
var f *os.File
// Example #2, https://golang.org/pkg/os/#OpenFile
2021-02-26 20:27:35 -05:00
if f, err = os.OpenFile(path, appendFlags, logPerm); err != nil {
2021-02-26 15:52:29 -05:00
return
}
defer f.Close()
success = true
return
}