Adding debug messages
This commit is contained in:
parent
e646ec1b0c
commit
e361ed6b12
@ -7,9 +7,6 @@ import (
|
||||
"net/http"
|
||||
"time"
|
||||
|
||||
"os"
|
||||
"fmt"
|
||||
|
||||
"git.farhan.codes/farhan/fedilogue/shared"
|
||||
)
|
||||
|
||||
@ -95,7 +92,6 @@ func GetInstanceInfo(endpoint string, o shared.RunningInstance) shared.RunningIn
|
||||
|
||||
resp, err := DoTries(&o, req)
|
||||
if err != nil {
|
||||
fmt.Println("Exit 1")
|
||||
o.Software = "Unsupported"
|
||||
return o
|
||||
} else {
|
||||
@ -103,7 +99,6 @@ func GetInstanceInfo(endpoint string, o shared.RunningInstance) shared.RunningIn
|
||||
}
|
||||
|
||||
if resp.StatusCode != 200 {
|
||||
fmt.Println("Exit 2")
|
||||
o.Software = "Unsupported"
|
||||
return o
|
||||
}
|
||||
@ -111,7 +106,7 @@ func GetInstanceInfo(endpoint string, o shared.RunningInstance) shared.RunningIn
|
||||
var wellknownnodeinfo shared.WellKnownNodeInfo
|
||||
err = json.NewDecoder(resp.Body).Decode(&wellknownnodeinfo)
|
||||
if (err != nil) {
|
||||
fmt.Println("Exit 3")
|
||||
logDebug("GetInstanceInfo for ", endpoint, " Unable to decode " + wellknown_nodeinfo_uri)
|
||||
o.Software = "Unsupported"
|
||||
return o
|
||||
}
|
||||
@ -119,7 +114,6 @@ func GetInstanceInfo(endpoint string, o shared.RunningInstance) shared.RunningIn
|
||||
// There can be multiple entries of /.well-known/nodeinfo entries, we want the last
|
||||
length := len(wellknownnodeinfo.Links)
|
||||
if length == 0 {
|
||||
fmt.Println("Exit 4")
|
||||
o.Software = "Unsupported"
|
||||
return o
|
||||
}
|
||||
@ -131,7 +125,7 @@ func GetInstanceInfo(endpoint string, o shared.RunningInstance) shared.RunningIn
|
||||
|
||||
respActual, err := DoTries(&o, req)
|
||||
if err != nil {
|
||||
fmt.Println("Exit 5")
|
||||
logDebug("GetInstanceInfo for ", endpoint, " unable to connect receive " + wellknown_nodeinfo_uri)
|
||||
o.Software = "Unsupported"
|
||||
return o
|
||||
} else {
|
||||
@ -139,7 +133,7 @@ func GetInstanceInfo(endpoint string, o shared.RunningInstance) shared.RunningIn
|
||||
}
|
||||
|
||||
if respActual.StatusCode != 200 {
|
||||
fmt.Println("Exit 6")
|
||||
logDebug("GetInstanceInfo for ", endpoint, " Non-200 for " + wellknown_nodeinfo_uri)
|
||||
o.Software = "Unsupported"
|
||||
return o
|
||||
}
|
||||
@ -147,15 +141,13 @@ func GetInstanceInfo(endpoint string, o shared.RunningInstance) shared.RunningIn
|
||||
var actualnodeinfo shared.ActualNodeInfo
|
||||
err = json.NewDecoder(respActual.Body).Decode(&actualnodeinfo)
|
||||
if (err != nil) {
|
||||
fmt.Println("Exit 7")
|
||||
fmt.Println(err)
|
||||
logDebug("GetInstanceInfo for ", endpoint, " Unable to decode " + actual_nodeinfo_uri)
|
||||
o.Software = "Unsupported"
|
||||
return o
|
||||
}
|
||||
|
||||
fmt.Println(actualnodeinfo)
|
||||
fmt.Println("Final exit")
|
||||
os.Exit(1)
|
||||
o.Software = actualnodeinfo.Software.Name
|
||||
o.Version = actualnodeinfo.Software.Version
|
||||
|
||||
return o
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user