From a9e3513d5846d239caf8215437660eae3ad76885 Mon Sep 17 00:00:00 2001 From: Alex Luong Date: Mon, 29 Jul 2024 20:42:13 +0700 Subject: [PATCH] refactor: Use logger directly instead of creating a new one --- pkg/listen/connection.go | 8 ++------ pkg/listen/listen.go | 3 +-- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/pkg/listen/connection.go b/pkg/listen/connection.go index 55eea6b..9952417 100644 --- a/pkg/listen/connection.go +++ b/pkg/listen/connection.go @@ -71,17 +71,13 @@ func filterConnections(connections []*hookdecksdk.Connection, connectionFilterSt // When users want to listen to a single source but there is no connection for that source, // we can help user set up a new connection for it. func ensureConnections(client *hookdeckclient.Client, connections []*hookdecksdk.Connection, sources []*hookdecksdk.Source, isMultiSource bool, connectionFilterString string, cliPath string) ([]*hookdecksdk.Connection, error) { - l := log.StandardLogger() - if len(connections) > 0 || isMultiSource { - msg := fmt.Sprintf("Connection exists for Source \"%s\", Connection \"%s\", and CLI path \"%s\"", sources[0].Name, connectionFilterString, cliPath) - l.Debug(msg) + log.Debug(fmt.Sprintf("Connection exists for Source \"%s\", Connection \"%s\", and CLI path \"%s\"", sources[0].Name, connectionFilterString, cliPath)) return connections, nil } - msg := fmt.Sprintf("No connection found. Creating a connection for Source \"%s\", Connection \"%s\", and CLI path \"%s\"", sources[0].Name, connectionFilterString, cliPath) - l.Debug(msg) + log.Debug(fmt.Sprintf("No connection found. Creating a connection for Source \"%s\", Connection \"%s\", and CLI path \"%s\"", sources[0].Name, connectionFilterString, cliPath)) connectionDetails := struct { Label string `survey:"label"` diff --git a/pkg/listen/listen.go b/pkg/listen/listen.go index 888e48e..7b660c7 100644 --- a/pkg/listen/listen.go +++ b/pkg/listen/listen.go @@ -95,9 +95,8 @@ Specify a single destination to update the CLI path. For example, pass a connect *connections[0].Destination.CliPath != "" && *connections[0].Destination.CliPath != flags.CliPath { - l := log.StandardLogger() updateMsg := fmt.Sprintf("Updating destination CLI path from \"%s\" to \"%s\"", *connections[0].Destination.CliPath, flags.CliPath) - l.Debug(updateMsg) + log.Debug(updateMsg) path := flags.CliPath _, err := sdkClient.Destination.Update(context.Background(), connections[0].Destination.Id, &hookdecksdk.DestinationUpdateRequest{