logging: Add subsystem to log API (#19002)

Create new code paths for multiple subsystems in the code. This will
make maintaing this easier later.

Also introduce bugLogIf() for errors that should not happen in the first
place.
This commit is contained in:
Anis Eleuch
2024-04-04 13:04:40 +01:00
committed by GitHub
parent 2228eb61cb
commit 95bf4a57b6
123 changed files with 972 additions and 786 deletions
+4 -5
View File
@@ -23,7 +23,6 @@ import (
"math/rand"
"time"
"github.com/minio/minio/internal/logger"
"github.com/tidwall/gjson"
)
@@ -85,13 +84,13 @@ func performLicenseUpdate(ctx context.Context, objectAPI ObjectLayer) {
resp, err := globalSubnetConfig.Post(url, nil)
if err != nil {
logger.LogIf(ctx, fmt.Errorf("error from %s: %w", url, err))
subnetLogIf(ctx, fmt.Errorf("error from %s: %w", url, err))
return
}
r := gjson.Parse(resp).Get("license_v2")
if r.Index == 0 {
logger.LogIf(ctx, fmt.Errorf("license not found in response from %s", url))
internalLogIf(ctx, fmt.Errorf("license not found in response from %s", url))
return
}
@@ -104,13 +103,13 @@ func performLicenseUpdate(ctx context.Context, objectAPI ObjectLayer) {
kv := "subnet license=" + lic
result, err := setConfigKV(ctx, objectAPI, []byte(kv))
if err != nil {
logger.LogIf(ctx, fmt.Errorf("error setting subnet license config: %w", err))
internalLogIf(ctx, fmt.Errorf("error setting subnet license config: %w", err))
return
}
if result.Dynamic {
if err := applyDynamicConfigForSubSys(GlobalContext, objectAPI, result.Cfg, result.SubSys); err != nil {
logger.LogIf(ctx, fmt.Errorf("error applying subnet dynamic config: %w", err))
subnetLogIf(ctx, fmt.Errorf("error applying subnet dynamic config: %w", err))
return
}
globalNotificationSys.SignalConfigReload(result.SubSys)