24 lines
404 B
Go
24 lines
404 B
Go
package logging
|
|
|
|
import (
|
|
"os"
|
|
)
|
|
|
|
// testOpen attempts to open a file for writing to test for suitability as a LogFile path.
|
|
func testOpen(path string) (success bool, err error) {
|
|
|
|
var f *os.File
|
|
|
|
// Example #2, https://golang.org/pkg/os/#OpenFile
|
|
if f, err = os.OpenFile(path, appendFlags, logPerm); err != nil {
|
|
return
|
|
}
|
|
if err = f.Close(); err != nil {
|
|
return
|
|
}
|
|
|
|
success = true
|
|
|
|
return
|
|
}
|