Skip to content

Commit

Permalink
Create simple utility for logging with tags and log all remote mixer …
Browse files Browse the repository at this point in the history
…calls. (#1431)
  • Loading branch information
keyurva authored Oct 8, 2024
1 parent 8de1285 commit b63abfa
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions internal/util/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,20 @@ const (
SQLDriverMySQL // SQLDriverMySQL = 2
)

// Define the DCLogTag enum
type DCLogTag string

// Enum values for different log types
const (
DCLogRemoteMixerCall DCLogTag = "RemoteMixerCall"
// Add more log types as needed
)

// DCLog logs messages with the specified DCLogTag
func DCLog(tag DCLogTag, msg string) {
log.Printf("[DC][%s] %s", tag, msg)
}

// ZipAndEncode Compresses the given contents using gzip and encodes it in base64
func ZipAndEncode(contents []byte) (string, error) {
// Zip the string
Expand Down Expand Up @@ -663,6 +677,7 @@ func FetchRemote(
}
request.Header.Set("Content-Type", "application/json")
request.Header.Set("X-API-Key", metadata.RemoteMixerAPIKey)
DCLog(DCLogRemoteMixerCall, fmt.Sprintf("url=%s", url))
response, err := httpClient.Do(request)
if err != nil {
return err
Expand Down

0 comments on commit b63abfa

Please sign in to comment.