Improve debug info order

This commit is contained in:
Daniel 2023-05-24 10:49:16 +02:00
parent 82408ffa99
commit 2ee62061f4
2 changed files with 34 additions and 9 deletions

View file

@ -137,16 +137,24 @@ func debugInfo(ar *api.Request) (data []byte, err error) {
di.Style = ar.Request.URL.Query().Get("style") di.Style = ar.Request.URL.Query().Get("style")
// Add debug information. // Add debug information.
// Very basic information at the start.
di.AddVersionInfo() di.AddVersionInfo()
di.AddPlatformInfo(ar.Context()) di.AddPlatformInfo(ar.Context())
status.AddToDebugInfo(di)
config.AddToDebugInfo(di) // Errors and unexpected logs.
resolver.AddToDebugInfo(di)
captain.AddToDebugInfo(di)
compat.AddToDebugInfo(di)
di.AddLastReportedModuleError() di.AddLastReportedModuleError()
di.AddLastUnexpectedLogs() di.AddLastUnexpectedLogs()
// Status Information from various modules.
status.AddToDebugInfo(di)
captain.AddToDebugInfo(di)
resolver.AddToDebugInfo(di)
config.AddToDebugInfo(di)
// Detailed information.
updates.AddToDebugInfo(di) updates.AddToDebugInfo(di)
compat.AddToDebugInfo(di)
di.AddGoroutineStack() di.AddGoroutineStack()
// Return data. // Return data.

View file

@ -9,12 +9,15 @@ import (
"time" "time"
"github.com/safing/portbase/api" "github.com/safing/portbase/api"
"github.com/safing/portbase/config"
"github.com/safing/portbase/database/query" "github.com/safing/portbase/database/query"
"github.com/safing/portbase/utils/debug" "github.com/safing/portbase/utils/debug"
"github.com/safing/portmaster/compat"
"github.com/safing/portmaster/network/state" "github.com/safing/portmaster/network/state"
"github.com/safing/portmaster/process" "github.com/safing/portmaster/process"
"github.com/safing/portmaster/resolver" "github.com/safing/portmaster/resolver"
"github.com/safing/portmaster/status" "github.com/safing/portmaster/status"
"github.com/safing/portmaster/updates"
) )
func registerAPIEndpoints() error { func registerAPIEndpoints() error {
@ -72,17 +75,31 @@ func debugInfo(ar *api.Request) (data []byte, err error) {
di.Style = ar.Request.URL.Query().Get("style") di.Style = ar.Request.URL.Query().Get("style")
// Add debug information. // Add debug information.
// Very basic information at the start.
di.AddVersionInfo() di.AddVersionInfo()
di.AddPlatformInfo(ar.Context()) di.AddPlatformInfo(ar.Context())
status.AddToDebugInfo(di)
resolver.AddToDebugInfo(di) // Errors and unexpected logs.
di.AddLastReportedModuleError()
di.AddLastUnexpectedLogs()
// Network Connections.
AddNetworkDebugData( AddNetworkDebugData(
di, di,
ar.Request.URL.Query().Get("profile"), ar.Request.URL.Query().Get("profile"),
ar.Request.URL.Query().Get("where"), ar.Request.URL.Query().Get("where"),
) )
di.AddLastReportedModuleError()
di.AddLastUnexpectedLogs() // Status Information from various modules.
status.AddToDebugInfo(di)
// captain.AddToDebugInfo(di) // TODO: Cannot use due to import loop.
resolver.AddToDebugInfo(di)
config.AddToDebugInfo(di)
// Detailed information.
updates.AddToDebugInfo(di)
compat.AddToDebugInfo(di)
di.AddGoroutineStack() di.AddGoroutineStack()
// Return data. // Return data.