Skip to content

Commit c9cc3a2

Browse files
committed
print if there is no log descriptor
1 parent f359a0a commit c9cc3a2

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

log.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,6 @@ var (
1515

1616
func doLog(format string, args ...any) {
1717

18-
if logDesc == nil {
19-
return
20-
}
21-
2218
ctime := time.Now()
2319
_, filename, line, _ := runtime.Caller(1)
2420

@@ -29,6 +25,11 @@ func doLog(format string, args ...any) {
2925
text = fmt.Sprintf(format, args...)
3026
}
3127

28+
if logDesc == nil {
29+
fmt.Println(text)
30+
return
31+
}
32+
3233
date := fmt.Sprintf("%2v:%2v.%2v", ctime.Hour(), ctime.Minute(), ctime.Second())
3334
buf := fmt.Sprintf("%v: %15v:%5v: %v\n", date, filepath.Base(filename), line, text)
3435
_, err := logDesc.WriteString(buf)

0 commit comments

Comments
 (0)