Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (

igconfig "github.com/inspektor-gadget/inspektor-gadget/pkg/config"
containercollection "github.com/inspektor-gadget/inspektor-gadget/pkg/container-collection"
Comment on lines 20 to 21
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Import block is no longer gofmt-sorted after adding iglogger (the inspektor-gadget imports should be ordered lexicographically). Please run gofmt or reorder imports to avoid inconsistent formatting across the repo.

Suggested change
igconfig "github.com/inspektor-gadget/inspektor-gadget/pkg/config"
iglogger "github.com/inspektor-gadget/inspektor-gadget/pkg/logger"
containercollection "github.com/inspektor-gadget/inspektor-gadget/pkg/container-collection"
containercollection "github.com/inspektor-gadget/inspektor-gadget/pkg/container-collection"
igconfig "github.com/inspektor-gadget/inspektor-gadget/pkg/config"
iglogger "github.com/inspektor-gadget/inspektor-gadget/pkg/logger"

Copilot uses AI. Check for mistakes.
iglogger "github.com/inspektor-gadget/inspektor-gadget/pkg/logger"
beUtils "github.com/kubescape/backend/pkg/utils"
"github.com/kubescape/go-logger"
"github.com/kubescape/go-logger/helpers"
Expand Down Expand Up @@ -162,10 +163,10 @@ func main() {
// Create clients
logger.L().Info("Kubernetes mode is true")
k8sClient := k8sinterface.NewKubernetesApi()

// Fetch cluster UID from kube-system namespace
clusterUID := utils.GetClusterUID(k8sClient.GetKubernetesClient())

storageClient, err := storage.CreateStorage(clusterData.Namespace)
if err != nil {
logger.L().Ctx(ctx).Fatal("error creating the storage client", helpers.Error(err))
Expand Down Expand Up @@ -365,6 +366,11 @@ func main() {
if err := igconfig.Config.ReadInConfig(); err != nil {
logger.L().Warning("reading IG config", helpers.Error(err))
}
if logger.L().GetLevel() == "debug" {
iglogger.DefaultLogger().SetLevel(iglogger.DebugLevel)
} else {
iglogger.DefaultLogger().SetLevel(iglogger.ErrorLevel)
}
Comment on lines +369 to +373
Copy link

Copilot AI Feb 10, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sets Inspektor Gadget logging to Debug only when the global logger is exactly "debug", and to Error for all other levels. That behavior is not really "based on global log level" (e.g., if the app runs at info/warn, IG warnings/info will be suppressed). Consider mapping the global level to the closest IG level (debug/info/warn/error) or otherwise documenting why IG should be forced to Error in non-debug mode.

Copilot uses AI. Check for mistakes.
igK8sClient, err := containercollection.NewK8sClient(cfg.NodeName, "", "")
if err != nil {
logger.L().Fatal("error creating IG Kubernetes client", helpers.Error(err))
Expand Down
Loading