mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-02-18 00:17:39 +01:00
refactor: Use zerolog instead of fmt.Printf in config export
Replace raw fmt.Printf calls with structured zerolog logging for consistency with the rest of the codebase. This improves log formatting and enables proper log level filtering.
This commit is contained in:
@@ -14,6 +14,7 @@ import (
|
||||
|
||||
"github.com/rcourtman/pulse-go-rewrite/internal/alerts"
|
||||
"github.com/rcourtman/pulse-go-rewrite/internal/notifications"
|
||||
"github.com/rs/zerolog/log"
|
||||
"golang.org/x/crypto/pbkdf2"
|
||||
)
|
||||
|
||||
@@ -157,9 +158,9 @@ func (c *ConfigPersistence) ImportConfig(encryptedData string, passphrase string
|
||||
case "4.1", "":
|
||||
// current version, nothing to do
|
||||
case "4.0":
|
||||
fmt.Printf("Notice: Config was exported from version 4.0. API tokens were not included in that format.\n")
|
||||
log.Info().Msg("Config was exported from version 4.0. API tokens were not included in that format.")
|
||||
default:
|
||||
fmt.Printf("Warning: Config was exported from unsupported version %s. Proceeding with best effort.\n", exportData.Version)
|
||||
log.Warn().Str("version", exportData.Version).Msg("Config was exported from unsupported version. Proceeding with best effort.")
|
||||
}
|
||||
|
||||
tx, err := newImportTransaction(c.configDir)
|
||||
@@ -240,7 +241,7 @@ func (c *ConfigPersistence) ImportConfig(encryptedData string, passphrase string
|
||||
}
|
||||
guestMetadataStore := NewGuestMetadataStore(dataPath)
|
||||
if err := guestMetadataStore.ReplaceAll(exportData.GuestMetadata); err != nil {
|
||||
fmt.Printf("Warning: Failed to import guest metadata: %v\n", err)
|
||||
log.Warn().Err(err).Msg("Failed to import guest metadata")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user