fix timestamp not showing up

This commit is contained in:
Jeff Carr 2024-11-15 20:04:51 -06:00
parent 56145cd22a
commit fe562dbf1b
1 changed files with 8 additions and 2 deletions

View File

@ -24,24 +24,28 @@ func HttpMode(w http.ResponseWriter) {
httpMode = w httpMode = w
} }
func DaemonShow() { func DaemonShow() bool {
if daemonMode { if daemonMode {
fmt.Println("daemonMode=true") fmt.Println("daemonMode=true")
return true
} else { } else {
fmt.Println("daemonMode=false") fmt.Println("daemonMode=false")
return false
} }
} }
func realPrintln(a ...any) { func realPrintln(a ...any) {
if daemonMode { if daemonMode {
// in daemon mode, don't put timestamps on each line
if captureMode == nil { if captureMode == nil {
fmt.Println(a...) fmt.Println(a...)
} else { } else {
fmt.Fprintln(captureMode, a...) fmt.Fprintln(captureMode, a...)
} }
} else { } else {
// put timestamps on each line
if captureMode == nil { if captureMode == nil {
fmt.Println(a...) reallog.Println(a...)
} else { } else {
// TODO: add datestamp // TODO: add datestamp
fmt.Fprintln(captureMode, a...) fmt.Fprintln(captureMode, a...)
@ -55,12 +59,14 @@ func realPrintln(a ...any) {
func realPrintf(s string, a ...any) { func realPrintf(s string, a ...any) {
if daemonMode { if daemonMode {
// in daemon mode, don't put timestamps on each line
if captureMode == nil { if captureMode == nil {
fmt.Printf(s, a...) fmt.Printf(s, a...)
} else { } else {
fmt.Fprintf(captureMode, s, a...) fmt.Fprintf(captureMode, s, a...)
} }
} else { } else {
// put timestamps on each line
if captureMode == nil { if captureMode == nil {
reallog.Printf(s, a...) reallog.Printf(s, a...)
} else { } else {