MCPcopy Create free account
hub / github.com/PasarGuard/node / openLogFile

Function openLogFile

logger/logger.go:36–53  ·  view source on GitHub ↗
(path string)

Source from the content-addressed store, hash-verified

34}
35
36func openLogFile(path string) (*os.File, error) {
37 if path == "" {
38 return nil, nil
39 }
40
41 // Ensure the directory exists
42 dir := filepath.Dir(path)
43 if err := os.MkdirAll(dir, 0755); err != nil {
44 return nil, err
45 }
46
47 // Try to open the file, create if not exists, and append to it
48 f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_APPEND, 0666)
49 if err != nil {
50 return nil, err
51 }
52 return f, nil
53}
54
55func (l *Logger) SetLogFile(accessPath, errorPath string) error {
56 l.mu.Lock()

Callers 1

SetLogFileMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected