MCPcopy Create free account
hub / github.com/Cyinx/einx / MakeLogTimePath

Method MakeLogTimePath

slog/slog_write.go:82–102  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

80}
81
82func (this *LogWriter) MakeLogTimePath() {
83 now := time.Now()
84 dirName := fmt.Sprintf("%d-%02d-%02d",
85 now.Year(),
86 now.Month(),
87 now.Day())
88
89 this.path = path.Join(this.init_path, dirName)
90
91 this.MakePath()
92 zero_time := time.Date(now.Year(), now.Month(), now.Day(), 0, 0, 0, 0, now.Location())
93 delayTime := 24*60*60 - (now.Unix() - zero_time.Unix())
94
95 if this.dayTimer == nil {
96 this.dayTimer = time.NewTimer(time.Duration(delayTime) * time.Second)
97 } else {
98 this.dayTimer.Reset(time.Duration(delayTime) * time.Second)
99 }
100 this.syncLog()
101 this.filter = make(map[string]*FileWriter)
102}
103
104func (this *LogWriter) Run(b bool) {
105 defer this.Recover()

Callers 2

RunMethod · 0.95
doRunMethod · 0.95

Calls 3

MakePathMethod · 0.95
syncLogMethod · 0.95
ResetMethod · 0.65

Tested by

no test coverage detected