21 lines
374 B
Go
21 lines
374 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
|
|
}
|
|
defer f.Close()
|
|
|
|
success = true
|
|
|
|
return
|
|
}
|