Skip to content

Commit

Permalink
remove plugin loggers outside plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Janelle Law committed Nov 14, 2023
1 parent 7fa7ffb commit bf3716e
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion internal/alerting/syncer/syncer_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func NewAlertingSyncerV1(
init.Store(false)
server := &AlertManagerSyncerV1{
serverConfig: serverConfig,
lg: logger.NewPluginLogger().WithGroup("alerting-syncer"),
lg: logger.New().WithGroup("alerting-syncer"),
tlsConfig: tlsConfig,
}
go func() {
Expand Down
2 changes: 1 addition & 1 deletion pkg/alerting/drivers/backend/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ import (
// },
// body: nil,
// values: nil,
// logger: logger.NewPluginLogger().Named("alerting"),
// logger: logger.New().Named("alerting"),
// }
// }

Expand Down
5 changes: 3 additions & 2 deletions pkg/alerting/extensions/embedded_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@ import (
"errors"
"net/http"

"log/slog"

"github.com/rancher/opni/pkg/alerting/cache"
"github.com/rancher/opni/pkg/alerting/extensions/destination"
"github.com/rancher/opni/pkg/alerting/shared"
alertingv1 "github.com/rancher/opni/pkg/apis/alerting/v1"
"github.com/rancher/opni/pkg/logger"
"log/slog"

// add profiles
_ "net/http/pprof"
Expand Down Expand Up @@ -64,7 +65,7 @@ func StartOpniEmbeddedServer(
opniAddr string,
sendK8s bool,
) *http.Server {
lg := logger.NewPluginLogger().WithGroup("opni.alerting")
lg := logger.New().WithGroup("opni.alerting")
es := NewEmbeddedServer(lg, 125, sendK8s)
mux := http.NewServeMux()

Expand Down
2 changes: 1 addition & 1 deletion pkg/alerting/storage/stores.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func NewDefaultAlertingBroker(js nats.JetStreamContext, opts ...storage_opts.Cli
options := &storage_opts.ClientSetOptions{}
options.Apply(opts...)
if options.Logger == nil {
options.Logger = logger.NewPluginLogger().WithGroup("alerting-storage-client-set")
options.Logger = logger.New().WithGroup("alerting-storage-client-set")
}
if options.TrackerTtl == 0 {
options.TrackerTtl = defaultTrackerTTLV1
Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ func NewReconciler(
collector: instance,
tmpl: otel.OTELTemplates,
ctx: ctx,
lg: logger.New().WithGroup("plugin").WithGroup("collector-controller"),
lg: logger.New().WithGroup("collector-controller"),
PrometheusDiscovery: nil,
}
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/util/nats/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func AcquireNATSConnection(
opts ...NatsAcquireOption,
) (*nats.Conn, error) {
options := &natsAcquireOptions{
lg: logger.NewPluginLogger().WithGroup("nats-conn"),
lg: logger.New().WithGroup("nats-conn"),
retrier: backoffv2.Exponential(
backoffv2.WithMaxRetries(0),
backoffv2.WithMinInterval(5*time.Second),
Expand Down

0 comments on commit bf3716e

Please sign in to comment.