MCPcopy
hub / github.com/OpenNHP/opennhp / Start

Method Start

nhp/log/logger.go:40–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

38}
39
40func (lw *AsyncLogWriter) Start() {
41 lw.currDate = time.Now().Format("2006-01-02")
42
43 if lw.msg == nil {
44 if len(lw.DirPath) > 0 {
45 err := os.MkdirAll(lw.DirPath, os.ModePerm)
46 if err != nil {
47 fmt.Printf("Warning: AsyncLogWriter cannot create directory %s (%v). Using current working directory instead.\n", lw.DirPath, err)
48 lw.DirPath = ""
49 }
50 }
51
52 lw.msg = make(chan []byte, LogQueueSize)
53 lw.wg.Add(1)
54 go lw.writeRoutine()
55 }
56}
57
58// async writer
59// must be initiated first, implements atomic write

Callers 2

NewLoggerFunction · 0.45
NewLoggerDefineFunction · 0.45

Calls 2

writeRoutineMethod · 0.95
AddMethod · 0.65

Tested by

no test coverage detected