Adding timestamps to log output (re: #121)

This commit is contained in:
Gregory Kurtzer
2021-09-09 21:16:07 -07:00
parent a71c060b15
commit e3eb57efcd
10 changed files with 57 additions and 81 deletions

View File

@@ -1,12 +1,11 @@
package warewulfd
import (
"fmt"
"net/http"
"os"
"os/signal"
"syscall"
"github.com/hpcng/warewulf/internal/pkg/wwlog"
)
// TODO: https://github.com/danderson/netboot/blob/master/pixiecore/dhcp.go
@@ -21,18 +20,16 @@ func RunServer() error {
for range c {
err := LoadNodeDB()
if err != nil {
wwlog.Printf(wwlog.WARN, "Could not load database: %s\n", err)
fmt.Printf("ERROR: Could not load database: %s\n", err)
}
}
}()
err := LoadNodeDB()
if err != nil {
wwlog.Printf(wwlog.WARN, "Could not load database: %s\n", err)
fmt.Printf("ERROR: Could not load database: %s\n", err)
}
wwlog.Printf(wwlog.DEBUG, "Registering handlers for the web service\n")
http.HandleFunc("/ipxe/", IpxeSend)
http.HandleFunc("/kernel/", KernelSend)
http.HandleFunc("/kmods/", KmodsSend)
@@ -40,11 +37,11 @@ func RunServer() error {
http.HandleFunc("/overlay-system/", SystemOverlaySend)
http.HandleFunc("/overlay-runtime", RuntimeOverlaySend)
wwlog.Printf(wwlog.VERBOSE, "Starting HTTPD REST service\n")
daemonLogf("Starting HTTPD REST service\n")
err = http.ListenAndServe(":9873", nil)
if err != nil {
wwlog.Printf(wwlog.ERROR, "Could not start listening service: %s\n", err)
fmt.Printf("ERROR: Could not start listening service: %s\n", err)
os.Exit(1)
}