Logging Adjustments

This commit is contained in:
Fred Boniface 2023-08-11 15:33:18 +01:00
parent 3d5f755226
commit 43ebc5e4f3
2 changed files with 20 additions and 5 deletions

View File

@ -1,8 +1,14 @@
package imaging
import "image"
import (
"fmt"
"image"
"git.fjla.uk/fred.boniface/map-dots/log"
)
func Generate(height, width int, style, format string, data []string) image.Image {
log.Msg.Debug("Image generation request: " + fmt.Sprint(width) + "x" + fmt.Sprint(height) + " " + format + " " + style)
img := createCanvas(width, height)
return img
}

View File

@ -8,6 +8,9 @@ import (
"net/url"
"strconv"
"time"
"git.fjla.uk/fred.boniface/map-dots/imaging"
"git.fjla.uk/fred.boniface/map-dots/log"
)
func Server() {
@ -18,10 +21,12 @@ func Server() {
http.HandleFunc("/help/", handleHelpRequest)
serverAddr := "localhost:8198" // Set your desired server address
fmt.Printf("Server listening on http://%s\n", serverAddr)
fmt.Printf("Starting server on http://%s\n", serverAddr)
log.Msg.Info("Starting server on http://" + serverAddr)
err := http.ListenAndServe(serverAddr, nil)
if err != nil {
fmt.Printf("Error starting server: %s\n", err)
log.Msg.Error("Server failed to start:" + err.Error())
}
}
@ -36,7 +41,11 @@ func handleTraccarRequest(w http.ResponseWriter, r *http.Request) {
return
}
fmt.Println(id, from, to, height, width, style, format)
fmt.Println(id, from, to)
var nullArry []string
var _ = imaging.Generate(height, width, style, format, nullArry)
message := map[string]string{
"status": "success",
@ -77,10 +86,10 @@ func validateAndProcessParams(queryValues url.Values) (string, string, string, i
to = time.Now().UTC().Format(time.RFC3339)
}
if heightStr == "" {
heightStr = "300"
heightStr = "1080"
}
if widthStr == "" {
widthStr = "400"
widthStr = "1920"
}
if style == "" {
style = "circle"