fix log line

This commit is contained in:
Antoni Sawicki
2026-03-14 21:28:40 -07:00
parent 61af9046ae
commit ef43ef5ce6
2 changed files with 7 additions and 5 deletions

11
util.go
View File

@@ -17,16 +17,17 @@ import (
func printMyIPs(b string) {
ap := strings.Split(b, ":")
if len(ap) < 1 {
if len(ap) < 2 {
log.Fatal("Wrong format of ipaddress:port")
}
log.Printf("Listen address: %v", b)
port := ap[len(ap)-1]
if ap[0] != "" && ap[0] != "0.0.0.0" {
log.Printf("Listen address: %v", b)
return
}
a, err := net.InterfaceAddrs()
if err != nil {
log.Print("Unable to get interfaces: ", err)
log.Printf("Listen address: %v", b)
return
}
var m string
@@ -35,9 +36,9 @@ func printMyIPs(b string) {
if !ok || n.IP.IsLoopback() || strings.Contains(n.IP.String(), ":") {
continue
}
m = m + n.IP.String() + " "
m += n.IP.String() + ":" + port + " "
}
log.Print("My IP addresses: ", m)
log.Printf("Listen address: %v", m)
}
func gifPalette(i image.Image, n int64) image.Image {

1
wrp.go
View File

@@ -350,6 +350,7 @@ func main() {
*addr = ":" + os.Getenv(("PORT"))
}
printMyIPs(*addr)
log.Printf("Default mode: %v", *wrpMode)
n, err := fmt.Sscanf(*fgeom, "%dx%dx%d", &defGeom.w, &defGeom.h, &defGeom.c)
if err != nil || n != 3 {
log.Fatalf("Unable to parse -g geometry flag / %s", err)