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

Method SetLogFile

logger/logger.go:55–76  ·  view source on GitHub ↗
(accessPath, errorPath string)

Source from the content-addressed store, hash-verified

53}
54
55func (l *Logger) SetLogFile(accessPath, errorPath string) error {
56 l.mu.Lock()
57 defer l.mu.Unlock()
58
59 var err error
60
61 if l.accessLogFile, err = openLogFile(accessPath); err != nil {
62 return fmt.Errorf("failed to open access log: %w", err)
63 }
64 if l.accessLogFile != nil {
65 l.accessLogger = log.New(l.accessLogFile, "", 0)
66 }
67
68 if l.errorLogFile, err = openLogFile(errorPath); err != nil {
69 return fmt.Errorf("failed to open error log: %w", err)
70 }
71 if l.errorLogFile != nil {
72 l.errorLogger = log.New(l.errorLogFile, "", 0)
73 }
74
75 return nil
76}
77
78func (l *Logger) Log(level LogLevel, message string) {
79 l.mu.RLock()

Callers 2

TestDetectLogTypeFunction · 0.80
StartMethod · 0.80

Calls 1

openLogFileFunction · 0.85

Tested by 1

TestDetectLogTypeFunction · 0.64