MCPcopy Create free account
hub / github.com/devfeel/dotweb / writeLog

Method writeLog

logger/xlog.go:127–142  ·  view source on GitHub ↗
(chanLog chanLog, level string)

Source from the content-addressed store, hash-verified

125}
126
127func (l *xLog) writeLog(chanLog chanLog, level string) {
128 filePath := l.logRootPath + chanLog.LogTarget
129 switch level {
130 case "custom":
131 filePath = filePath + "_" + time.Now().Format(defaultDateFormatForFileName) + ".log"
132 break
133 }
134 log := chanLog.Content
135 if !chanLog.isRaw {
136 log = fmt.Sprintf("%s [%s] [%s:%v] %s", time.Now().Format(defaultFullTimeLayout), chanLog.LogLevel, chanLog.logCtx.fileName, chanLog.logCtx.line, chanLog.Content)
137 }
138 if l.enabledConsole {
139 fmt.Println(log)
140 }
141 writeFile(filePath, log)
142}
143
144func writeFile(logFile string, log string) {
145 pathDir := filepath.Dir(logFile)

Callers 1

handleCustomMethod · 0.95

Calls 1

writeFileFunction · 0.85

Tested by

no test coverage detected