From 887ea1d15125f2a4599dc8cbf46a32071977bff0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Tue, 3 Feb 2026 23:32:29 +0200 Subject: [PATCH] Replace logrus with log/slog --- .github/copilot-instructions.md | 4 +-- client/client.go | 4 +-- client/helper.go | 24 +++---------- cmd/apps.go | 6 ++-- cmd/apps_changelog.go | 6 ++-- cmd/apps_info.go | 5 +-- cmd/apps_install.go | 5 +-- cmd/apps_logs.go | 5 +-- cmd/apps_rebuild.go | 5 +-- cmd/apps_restart.go | 5 +-- cmd/apps_start.go | 5 +-- cmd/apps_stats.go | 5 +-- cmd/apps_stop.go | 5 +-- cmd/apps_uninstall.go | 5 +-- cmd/apps_update.go | 7 ++-- cmd/audio.go | 5 +-- cmd/audio_default.go | 5 +-- cmd/audio_default_input.go | 5 +-- cmd/audio_default_output.go | 5 +-- cmd/audio_info.go | 5 +-- cmd/audio_logs.go | 5 +-- cmd/audio_profile.go | 5 +-- cmd/audio_reload.go | 5 +-- cmd/audio_restart.go | 5 +-- cmd/audio_stats.go | 5 +-- cmd/audio_update.go | 5 +-- cmd/audio_volume.go | 4 +-- cmd/audio_volume_input.go | 5 +-- cmd/audio_volume_output.go | 5 +-- cmd/auth.go | 5 +-- cmd/auth_cache.go | 5 +-- cmd/auth_list.go | 5 +-- cmd/auth_reset.go | 4 +-- cmd/available_updates.go | 5 +-- cmd/backups.go | 6 ++-- cmd/backups_freeze.go | 5 +-- cmd/backups_info.go | 5 +-- cmd/backups_new.go | 13 +++---- cmd/backups_options.go | 4 +-- cmd/backups_reload.go | 5 +-- cmd/backups_remove.go | 9 ++--- cmd/backups_restore.go | 11 +++--- cmd/backups_thaw.go | 5 +-- cmd/banner.go | 4 +-- cmd/cli_info.go | 5 +-- cmd/cli_stats.go | 5 +-- cmd/cli_update.go | 5 +-- cmd/core_check.go | 5 +-- cmd/core_info.go | 5 +-- cmd/core_logs.go | 5 +-- cmd/core_options.go | 4 +-- cmd/core_rebuild.go | 5 +-- cmd/core_restart.go | 5 +-- cmd/core_start.go | 5 +-- cmd/core_stats.go | 5 +-- cmd/core_stop.go | 5 +-- cmd/core_update.go | 5 +-- cmd/dns_info.go | 5 +-- cmd/dns_logs.go | 5 +-- cmd/dns_options.go | 7 ++-- cmd/dns_reset.go | 5 +-- cmd/dns_restart.go | 5 +-- cmd/dns_stats.go | 5 +-- cmd/dns_update.go | 5 +-- cmd/docker_info.go | 5 +-- cmd/docker_migrate_storage_driver.go | 5 +-- cmd/docker_options.go | 4 +-- cmd/docker_registries.go | 5 +-- cmd/docker_registries_add.go | 7 ++-- cmd/docker_registries_delete.go | 5 +-- cmd/hardware.go | 5 +-- cmd/hardware_audio.go | 5 +-- cmd/hardware_info.go | 5 +-- cmd/host.go | 4 +-- cmd/host_disks_usage.go | 5 +-- cmd/host_info.go | 5 +-- cmd/host_logs.go | 4 +-- cmd/host_logs_boots.go | 4 +-- cmd/host_logs_identifiers.go | 5 +-- cmd/host_options.go | 5 +-- cmd/host_reboot.go | 5 +-- cmd/host_reload.go | 5 +-- cmd/host_shutdown.go | 5 +-- cmd/info.go | 5 +-- cmd/jobs_info.go | 5 +-- cmd/jobs_options.go | 5 +-- cmd/jobs_reset.go | 5 +-- cmd/mounts_add.go | 7 ++-- cmd/mounts_delete.go | 5 +-- cmd/mounts_info.go | 5 +-- cmd/mounts_options.go | 4 +-- cmd/mounts_reload.go | 5 +-- cmd/mounts_update.go | 7 ++-- cmd/multicast_info.go | 5 +-- cmd/multicast_logs.go | 5 +-- cmd/multicast_restart.go | 5 +-- cmd/multicast_stats.go | 5 +-- cmd/multicast_update.go | 5 +-- cmd/network.go | 5 +-- cmd/network_info.go | 5 +-- cmd/network_reload.go | 5 +-- cmd/network_scan.go | 5 +-- cmd/network_update.go | 7 ++-- cmd/network_vlan.go | 7 ++-- cmd/observer_info.go | 5 +-- cmd/observer_stats.go | 5 +-- cmd/observer_update.go | 5 +-- cmd/os_boards_green.go | 5 +-- cmd/os_boards_green_options.go | 4 +-- cmd/os_boards_yellow.go | 5 +-- cmd/os_boards_yellow_options.go | 4 +-- cmd/os_boot_slot.go | 5 +-- cmd/os_config_swap_info.go | 5 +-- cmd/os_config_swap_options.go | 4 +-- cmd/os_datadisk_list.go | 5 +-- cmd/os_datadisk_move.go | 5 +-- cmd/os_datadisk_wipe.go | 5 +-- cmd/os_import.go | 5 +-- cmd/os_info.go | 5 +-- cmd/os_update.go | 5 +-- cmd/refresh_updates.go | 5 +-- cmd/resolution_check_options.go | 7 ++-- cmd/resolution_check_run.go | 5 +-- cmd/resolution_healthcheck.go | 5 +-- cmd/resolution_info.go | 5 +-- cmd/resolution_issue_dismiss.go | 5 +-- cmd/resolution_issue_suggestions.go | 5 +-- cmd/resolution_suggestion_apply.go | 5 +-- cmd/resolution_suggestion_dismiss.go | 5 +-- cmd/root.go | 51 ++++++++++++++-------------- cmd/security_info.go | 5 +-- cmd/security_integrity.go | 5 +-- cmd/security_options.go | 4 +-- cmd/store.go | 7 ++-- cmd/store_apps.go | 4 +-- cmd/store_apps_install.go | 5 +-- cmd/store_apps_update.go | 7 ++-- cmd/store_reload.go | 5 +-- cmd/store_repositories_add.go | 7 ++-- cmd/store_repositories_delete.go | 5 +-- cmd/store_repositories_repair.go | 5 +-- cmd/supervisor.go | 5 +-- cmd/supervisor_available_updates.go | 5 +-- cmd/supervisor_info.go | 5 +-- cmd/supervisor_logs.go | 5 +-- cmd/supervisor_options.go | 4 +-- cmd/supervisor_reload.go | 5 +-- cmd/supervisor_repair.go | 5 +-- cmd/supervisor_restart.go | 5 +-- cmd/supervisor_stats.go | 5 +-- cmd/supervisor_update.go | 5 +-- go.mod | 1 - go.sum | 2 -- main.go | 4 +-- 154 files changed, 480 insertions(+), 372 deletions(-) diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index 3fc73324..615779ca 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -20,7 +20,7 @@ The CLI is communicating with the Supervisor using the Supervisor's HTTP REST AP - **CLI Framework**: Cobra (github.com/spf13/cobra) - **HTTP Client**: Resty (github.com/go-resty/resty/v2) - **Configuration**: Viper (github.com/spf13/viper) -- **Logging**: Logrus (github.com/sirupsen/logrus) +- **Logging**: Go stdlib log/slog ## Available Commands The CLI provides the following main command categories: @@ -62,7 +62,7 @@ The CLI provides the following main command categories: - Uses Cobra for command structure and flag parsing - Resty for HTTP API calls to Home Assistant Supervisor - Viper for configuration management -- Logrus for structured logging +- Go stdlib log/slog for structured logging - Custom spinner implementation for progress indication ## Testing diff --git a/client/client.go b/client/client.go index 176877a8..ebc176c2 100644 --- a/client/client.go +++ b/client/client.go @@ -2,11 +2,11 @@ package client import ( "fmt" + "log/slog" "net/http" "time" resty "github.com/go-resty/resty/v2" - log "github.com/sirupsen/logrus" ) // RawJSON controls if the client does json handling or outputs it raw @@ -61,7 +61,7 @@ func genericJSONMethod(get bool, section, command string, body map[string]any, t resp, err = request.Get(url) } else { if len(body) > 0 { - log.WithField("body", body).Debug("Request body") + slog.Debug("Request body", "body", body) request.SetBody(body) } resp, err = request.Post(url) diff --git a/client/helper.go b/client/helper.go index da5b0543..0e85b1e4 100644 --- a/client/helper.go +++ b/client/helper.go @@ -6,6 +6,7 @@ import ( "errors" "fmt" "io" + "log/slog" "net/url" "os" "os/signal" @@ -18,7 +19,6 @@ import ( yaml "github.com/ghodss/yaml" resty "github.com/go-resty/resty/v2" - log "github.com/sirupsen/logrus" "github.com/spf13/viper" "strings" @@ -43,11 +43,7 @@ type Response struct { // URLHelper returns a URL built from the arguments func URLHelper(section, command string) (string, error) { base := viper.GetString("endpoint") - log.WithFields(log.Fields{ - "base": base, - "section": section, - "command": command, - }).Debug("[GenerateURI]") + slog.Debug("[GenerateURI]", "base", base, "section", section, "command", command) scheme := "" if !strings.Contains(base, "://") { @@ -69,11 +65,7 @@ func URLHelper(section, command string) (string, error) { myurl.Path = path.Clean(myurl.Path) res, _ := url.PathUnescape(myurl.String()) - log.WithFields(log.Fields{ - "uri": uri, - "url": myurl, - "url(string)": res, - }).Debug("[GenerateURI] Result") + slog.Debug("[GenerateURI] Result", "uri", uri, "url", myurl, "url(string)", res) return res, nil } @@ -108,15 +100,7 @@ func GetRequestTimeout(timeout time.Duration) *resty.Request { // Registering Response Middleware client.OnAfterResponse(func(c *resty.Client, resp *resty.Response) error { // explore response object - log.WithFields(log.Fields{ - "statuscode": resp.StatusCode(), - "status": resp.Status(), - "time": resp.Time(), - "received-at": resp.ReceivedAt(), - "headers": resp.Header(), - "request": resp.Request.RawRequest, - "body": resp, - }).Debug("Response") + slog.Debug("Response", "statuscode", resp.StatusCode(), "status", resp.Status(), "time", resp.Time(), "received-at", resp.ReceivedAt(), "headers", resp.Header(), "request", resp.Request.RawRequest, "body", resp) return nil // if its success otherwise return error }) diff --git a/cmd/apps.go b/cmd/apps.go index 81583cf7..5eb9924e 100644 --- a/cmd/apps.go +++ b/cmd/apps.go @@ -1,11 +1,11 @@ package cmd import ( + "log/slog" "os" "strings" helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -30,7 +30,7 @@ information commands for apps.`, rootCmd.PersistentPreRun(cmd, args) }, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("apps") + slog.Debug("apps", "args", args) section := "addons" command := "" @@ -46,7 +46,7 @@ information commands for apps.`, } func init() { - log.Debug("Init apps") + slog.Debug("Init apps") rootCmd.AddCommand(appsCmd) } diff --git a/cmd/apps_changelog.go b/cmd/apps_changelog.go index 536443b6..d1c7b958 100644 --- a/cmd/apps_changelog.go +++ b/cmd/apps_changelog.go @@ -3,9 +3,9 @@ package cmd import ( "errors" "fmt" + "log/slog" helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -22,7 +22,7 @@ ha apps changelog core_mosquitto`, ValidArgsFunction: appsCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("apps changelog") + slog.Debug("apps changelog", "args", args) section := "addons" command := "{slug}/changelog" @@ -48,7 +48,7 @@ ha apps changelog core_mosquitto`, // returns 200 OK or 400, everything else is wrong if err == nil && resp.StatusCode() != 200 && resp.StatusCode() != 400 { err = errors.New("unexpected server response") - log.Error(err) + slog.Error("unexpected server response", "status", resp.StatusCode()) } if err != nil { diff --git a/cmd/apps_info.go b/cmd/apps_info.go index d0f73e89..e7d3971b 100644 --- a/cmd/apps_info.go +++ b/cmd/apps_info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -21,7 +22,7 @@ is provided, information about a specific app. ValidArgsFunction: appsCompletions, Args: cobra.MaximumNArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("apps info") + slog.Debug("apps info", "args", args) section := "addons" command := "{slug}/info" diff --git a/cmd/apps_install.go b/cmd/apps_install.go index ab2f7080..c39d562c 100644 --- a/cmd/apps_install.go +++ b/cmd/apps_install.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ This command allows you to install a Home Assistant app from the commandline. ValidArgsFunction: storeAppCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("apps install") + slog.Debug("apps install", "args", args) section := "addons" command := "{slug}/install" diff --git a/cmd/apps_logs.go b/cmd/apps_logs.go index 9510b342..37b78e49 100644 --- a/cmd/apps_logs.go +++ b/cmd/apps_logs.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Allowing you to look at the log output generated by a Home Assistant app. ValidArgsFunction: appsCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("apps logs") + slog.Debug("apps logs", "args", args) section := "addons/{slug}" diff --git a/cmd/apps_rebuild.go b/cmd/apps_rebuild.go index f0989ebf..15bcd537 100644 --- a/cmd/apps_rebuild.go +++ b/cmd/apps_rebuild.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -24,7 +25,7 @@ of apps. This command allows you to trigger a rebuild of a locally built app. ValidArgsFunction: appsCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("apps rebuild") + slog.Debug("apps rebuild", "args", args) section := "addons" command := "{slug}/rebuild" diff --git a/cmd/apps_restart.go b/cmd/apps_restart.go index a7d0ced8..0091a194 100644 --- a/cmd/apps_restart.go +++ b/cmd/apps_restart.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Restart a Home Assistant app ValidArgsFunction: appsCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("apps restart") + slog.Debug("apps restart", "args", args) section := "addons" command := "{slug}/restart" diff --git a/cmd/apps_start.go b/cmd/apps_start.go index 51c961b9..5e202f19 100644 --- a/cmd/apps_start.go +++ b/cmd/apps_start.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ This command allows you to manually start a stopped Home Assistant app ValidArgsFunction: appsCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("apps start") + slog.Debug("apps start", "args", args) section := "addons" command := "{slug}/start" diff --git a/cmd/apps_stats.go b/cmd/apps_stats.go index 2c9753dc..7e943372 100644 --- a/cmd/apps_stats.go +++ b/cmd/apps_stats.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ how much CPU, memory, disk & network resources it uses. ValidArgsFunction: appsCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("apps stats") + slog.Debug("apps stats", "args", args) section := "addons" command := "{slug}/stats" diff --git a/cmd/apps_stop.go b/cmd/apps_stop.go index 53dde790..e111955a 100644 --- a/cmd/apps_stop.go +++ b/cmd/apps_stop.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ This command allows you to manually stop a Home Assistant app ValidArgsFunction: appsCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("apps stop") + slog.Debug("apps stop", "args", args) section := "addons" command := "{slug}/stop" diff --git a/cmd/apps_uninstall.go b/cmd/apps_uninstall.go index a13ed53f..a6d99259 100644 --- a/cmd/apps_uninstall.go +++ b/cmd/apps_uninstall.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ This command allows you to uninstall a Home Assistant app. ValidArgsFunction: appsCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("apps uninstall") + slog.Debug("apps uninstall", "args", args) section := "addons" command := "{slug}/uninstall" diff --git a/cmd/apps_update.go b/cmd/apps_update.go index f1e4ad83..ce339cba 100644 --- a/cmd/apps_update.go +++ b/cmd/apps_update.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ It is currently not possible to upgrade/downgrade to a specific version. ValidArgsFunction: appsCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("apps update") + slog.Debug("apps update", "args", args) section := "addons" command := "{slug}/update" @@ -51,7 +52,7 @@ It is currently not possible to upgrade/downgrade to a specific version. } if len(options) > 0 { - log.WithField("options", options).Debug("Request body") + slog.Debug("Request body", "options", options) request.SetBody(options) } diff --git a/cmd/audio.go b/cmd/audio.go index c47aa842..afc665bb 100644 --- a/cmd/audio.go +++ b/cmd/audio.go @@ -1,7 +1,8 @@ package cmd import ( - log "github.com/sirupsen/logrus" + "log/slog" + "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ Control audio devices. } func init() { - log.Debug("Init audio") + slog.Debug("Init audio") rootCmd.AddCommand(audioCmd) } diff --git a/cmd/audio_default.go b/cmd/audio_default.go index 87f4c4dd..9b3585aa 100644 --- a/cmd/audio_default.go +++ b/cmd/audio_default.go @@ -1,7 +1,8 @@ package cmd import ( - log "github.com/sirupsen/logrus" + "log/slog" + "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Set the default input/output audio device of your Home Assistant system. } func init() { - log.Debug("Init audio default") + slog.Debug("Init audio default") audioCmd.AddCommand(audioDefaultCmd) } diff --git a/cmd/audio_default_input.go b/cmd/audio_default_input.go index 5902acae..15c2f5b1 100644 --- a/cmd/audio_default_input.go +++ b/cmd/audio_default_input.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Home Assistant Audio on your Home Assistant system.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("audio default input") + slog.Debug("audio default input", "args", args) section := "audio" command := "default/input" diff --git a/cmd/audio_default_output.go b/cmd/audio_default_output.go index 3a156a21..24ec8f4c 100644 --- a/cmd/audio_default_output.go +++ b/cmd/audio_default_output.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Home Assistant Audio on your Home Assistant system.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("audio default output") + slog.Debug("audio default output", "args", args) section := "audio" command := "default/output" diff --git a/cmd/audio_info.go b/cmd/audio_info.go index d5975e8d..cedbd400 100644 --- a/cmd/audio_info.go +++ b/cmd/audio_info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ running on your Home Assistant system, including its devices.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("audio info") + slog.Debug("audio info", "args", args) section := "audio" command := "info" diff --git a/cmd/audio_logs.go b/cmd/audio_logs.go index 367ec83c..565419b6 100644 --- a/cmd/audio_logs.go +++ b/cmd/audio_logs.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ running on your Home Assistant system.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("audio logs") + slog.Debug("audio logs", "args", args) section := "audio" diff --git a/cmd/audio_profile.go b/cmd/audio_profile.go index 325dcc55..e1895a57 100644 --- a/cmd/audio_profile.go +++ b/cmd/audio_profile.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ This command allows you to set the audio profile on a audio card.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("audio profile") + slog.Debug("audio profile", "args", args) section := "audio" command := "profile" diff --git a/cmd/audio_reload.go b/cmd/audio_reload.go index 0b9c34c7..7b742403 100644 --- a/cmd/audio_reload.go +++ b/cmd/audio_reload.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ all data and devices it currently has.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("audio reload") + slog.Debug("audio reload", "args", args) section := "audio" command := "reload" diff --git a/cmd/audio_restart.go b/cmd/audio_restart.go index aa286bdb..f60d646c 100644 --- a/cmd/audio_restart.go +++ b/cmd/audio_restart.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -16,7 +17,7 @@ var audioRestartCmd = &cobra.Command{ ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("audio restart") + slog.Debug("audio restart", "args", args) section := "audio" command := "restart" diff --git a/cmd/audio_stats.go b/cmd/audio_stats.go index ad416e13..6ba2e3ac 100644 --- a/cmd/audio_stats.go +++ b/cmd/audio_stats.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ It shows you how much CPU, memory, disk & network resources it uses.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("audio stats") + slog.Debug("audio stats", "args", args) section := "audio" command := "stats" diff --git a/cmd/audio_update.go b/cmd/audio_update.go index c79b3691..3d5c1c14 100644 --- a/cmd/audio_update.go +++ b/cmd/audio_update.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ instance running on your system to the latest version or the version specified.` ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("audio update") + slog.Debug("audio update", "args", args) section := "audio" command := "update" diff --git a/cmd/audio_volume.go b/cmd/audio_volume.go index 0bf6fab9..933be6ea 100644 --- a/cmd/audio_volume.go +++ b/cmd/audio_volume.go @@ -1,9 +1,9 @@ package cmd import ( + "log/slog" "strconv" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -23,7 +23,7 @@ Control the volume of your audio devices. } func init() { - log.Debug("Init audio volume") + slog.Debug("Init audio volume") audioCmd.AddCommand(audioVolumeCmd) } diff --git a/cmd/audio_volume_input.go b/cmd/audio_volume_input.go index ebab83e8..16c43788 100644 --- a/cmd/audio_volume_input.go +++ b/cmd/audio_volume_input.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -24,7 +25,7 @@ input channel or application on your Home Assistant system.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("audio volume input") + slog.Debug("audio volume input", "args", args) section := "audio" command := "volume/input" diff --git a/cmd/audio_volume_output.go b/cmd/audio_volume_output.go index faa5ce45..d123e9ac 100644 --- a/cmd/audio_volume_output.go +++ b/cmd/audio_volume_output.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -24,7 +25,7 @@ output channel or application on your Home Assistant system.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("audio volume output") + slog.Debug("audio volume output", "args", args) section := "audio" command := "volume/output" diff --git a/cmd/auth.go b/cmd/auth.go index c95a4b0e..8ec82b01 100644 --- a/cmd/auth.go +++ b/cmd/auth.go @@ -1,7 +1,8 @@ package cmd import ( - log "github.com/sirupsen/logrus" + "log/slog" + "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ The authentication command allows you to manage Home Assistant user accounts. } func init() { - log.Debug("Init authentication") + slog.Debug("Init authentication") rootCmd.AddCommand(authCmd) } diff --git a/cmd/auth_cache.go b/cmd/auth_cache.go index 16501aa2..ce785ff6 100644 --- a/cmd/auth_cache.go +++ b/cmd/auth_cache.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ This command allows you to reset the internal password cache of a Home Assistant ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("auth cache") + slog.Debug("auth cache", "args", args) section := "auth" command := "cache" diff --git a/cmd/auth_list.go b/cmd/auth_list.go index d3b66d87..a3156865 100644 --- a/cmd/auth_list.go +++ b/cmd/auth_list.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -21,7 +22,7 @@ only work on some locations. For example, the Operating System CLI. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("auth list") + slog.Debug("auth list", "args", args) section := "auth" command := "list" diff --git a/cmd/auth_reset.go b/cmd/auth_reset.go index 3f0957c5..f17b7535 100644 --- a/cmd/auth_reset.go +++ b/cmd/auth_reset.go @@ -2,9 +2,9 @@ package cmd import ( "fmt" + "log/slog" helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -78,7 +78,7 @@ only work on some locations. For example, the Operating System CLI. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("auth reset") + slog.Debug("auth reset", "args", args) section := "auth" command := "reset" diff --git a/cmd/available_updates.go b/cmd/available_updates.go index 34e0751e..d8927667 100644 --- a/cmd/available_updates.go +++ b/cmd/available_updates.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ This command provides information about the currently pending updates on the sys ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("available_updates") + slog.Debug("available_updates", "args", args) section := "available_updates" command := "" diff --git a/cmd/backups.go b/cmd/backups.go index 762ebf7c..487edb4a 100644 --- a/cmd/backups.go +++ b/cmd/backups.go @@ -1,11 +1,11 @@ package cmd import ( + "log/slog" "os" "strings" helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -30,7 +30,7 @@ restore, and delete using this command.`, rootCmd.PersistentPreRun(cmd, args) }, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("backups") + slog.Debug("backups", "args", args) section := "backups" command := "info" @@ -46,7 +46,7 @@ restore, and delete using this command.`, } func init() { - log.Debug("Init backups") + slog.Debug("Init backups") // add cmd to root command rootCmd.AddCommand(backupsCmd) } diff --git a/cmd/backups_freeze.go b/cmd/backups_freeze.go index 49010d28..72431252 100644 --- a/cmd/backups_freeze.go +++ b/cmd/backups_freeze.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ or snapshot taken by external software. Caller should call thaw when done.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("backups freeze") + slog.Debug("backups freeze", "args", args) section := "backups" command := "freeze" diff --git a/cmd/backups_info.go b/cmd/backups_info.go index 0fdb1f25..67433d92 100644 --- a/cmd/backups_info.go +++ b/cmd/backups_info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ This command gives you information about a specific backup.`, ValidArgsFunction: backupsCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("backups info") + slog.Debug("backups info", "args", args) section := "backups" command := "{slug}/info" diff --git a/cmd/backups_new.go b/cmd/backups_new.go index b1134bba..c23286ff 100644 --- a/cmd/backups_new.go +++ b/cmd/backups_new.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -22,7 +23,7 @@ backup.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("backups new") + slog.Debug("backups new", "args", args) section := "backups" command := "new/full" @@ -42,7 +43,7 @@ backup.`, apps, err := cmd.Flags().GetStringArray("app") addonsDeprecated, _ := cmd.Flags().GetStringArray("addons") apps = append(apps, addonsDeprecated...) - log.WithField("app", apps).Debug("app") + slog.Debug("apps", "apps", apps) if len(apps) != 0 && err == nil && (cmd.Flags().Changed("app") || cmd.Flags().Changed("addons")) { options["addons"] = apps @@ -50,7 +51,7 @@ backup.`, } folders, err := cmd.Flags().GetStringArray("folders") - log.WithField("folders", folders).Debug("folders") + slog.Debug("folders", "folders", folders) if len(folders) != 0 && err == nil && cmd.Flags().Changed("folders") { options["folders"] = folders @@ -62,13 +63,13 @@ backup.`, } location, err := cmd.Flags().GetStringArray("location") - log.WithField("location", location).Debug("location") + slog.Debug("location", "location", location) if len(location) > 0 && err == nil && cmd.Flags().Changed("location") { options["location"] = location } filename, err := cmd.Flags().GetString("filename") - log.WithField("filename", filename).Debug("filename") + slog.Debug("filename", "filename", filename) if filename != "" && err == nil && cmd.Flags().Changed("filename") { options["filename"] = filename } diff --git a/cmd/backups_options.go b/cmd/backups_options.go index fcf2a35d..e006a3a3 100644 --- a/cmd/backups_options.go +++ b/cmd/backups_options.go @@ -1,10 +1,10 @@ package cmd import ( + "log/slog" "strings" helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/pflag" ) @@ -20,7 +20,7 @@ This command allows you to set configuration options for backup manager.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("backups options") + slog.Debug("backups options", "args", args) section := "backups" command := "options" diff --git a/cmd/backups_reload.go b/cmd/backups_reload.go index c817d6a7..f2368dfe 100644 --- a/cmd/backups_reload.go +++ b/cmd/backups_reload.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ on disk`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("backups reload") + slog.Debug("backups reload", "args", args) section := "backups" command := "reload" diff --git a/cmd/backups_remove.go b/cmd/backups_remove.go index 634e38ee..57238b8c 100644 --- a/cmd/backups_remove.go +++ b/cmd/backups_remove.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ clean backups from disk.`, ValidArgsFunction: backupsCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("backups remove") + slog.Debug("backups remove", "args", args) section := "backups" command := "{slug}" @@ -39,13 +40,13 @@ clean backups from disk.`, }) location, err := cmd.Flags().GetStringArray("location") - log.WithField("location", location).Debug("location") + slog.Debug("location", "location", location) if len(location) > 0 && err == nil && cmd.Flags().Changed(("location")) { options["location"] = location } if len(options) > 0 { - log.WithField("options", options).Debug("Request body") + slog.Debug("Request body", "options", options) request.SetBody(options) } diff --git a/cmd/backups_restore.go b/cmd/backups_restore.go index 0a9cc362..b58a219a 100644 --- a/cmd/backups_restore.go +++ b/cmd/backups_restore.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ take Home Assistant backup on your system.`, ValidArgsFunction: backupsCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("backups restore") + slog.Debug("backups restore", "args", args) section := "backups/{slug}" command := "restore/full" @@ -48,7 +49,7 @@ take Home Assistant backup on your system.`, apps, err := cmd.Flags().GetStringArray("app") addonsDeprecated, _ := cmd.Flags().GetStringArray("addons") apps = append(apps, addonsDeprecated...) - log.WithField("app", apps).Debug("app") + slog.Debug("apps", "apps", apps) if len(apps) > 0 && err == nil { options["addons"] = apps @@ -56,7 +57,7 @@ take Home Assistant backup on your system.`, } folders, err := cmd.Flags().GetStringArray("folders") - log.WithField("folders", folders).Debug("folders") + slog.Debug("folders", "folders", folders) if len(folders) > 0 && err == nil { options["folders"] = folders @@ -76,7 +77,7 @@ take Home Assistant backup on your system.`, } if len(options) > 0 { - log.WithField("options", options).Debug("Request body") + slog.Debug("Request body", "options", options) request.SetBody(options) } diff --git a/cmd/backups_thaw.go b/cmd/backups_thaw.go index 7f081890..edf2da16 100644 --- a/cmd/backups_thaw.go +++ b/cmd/backups_thaw.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ has completed.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("backups thaw") + slog.Debug("backups thaw", "args", args) section := "backups" command := "thaw" diff --git a/cmd/banner.go b/cmd/banner.go index aa139a94..f50b8e3b 100644 --- a/cmd/banner.go +++ b/cmd/banner.go @@ -2,11 +2,11 @@ package cmd import ( "fmt" + "log/slog" "strings" "time" helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -65,7 +65,7 @@ var bannerCmd = &cobra.Command{ ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("info") + slog.Debug("info", "args", args) fmt.Print(haBanner) fmt.Println() diff --git a/cmd/cli_info.go b/cmd/cli_info.go index 910a8ae6..2ff8a728 100644 --- a/cmd/cli_info.go +++ b/cmd/cli_info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Shows information about the internally running Home Assistant CLI backend ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("cli info") + slog.Debug("cli info", "args", args) section := "cli" command := "info" diff --git a/cmd/cli_stats.go b/cmd/cli_stats.go index 4ce50354..44813280 100644 --- a/cmd/cli_stats.go +++ b/cmd/cli_stats.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ It shows you how much CPU, memory, disk & network resources it uses. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("cli stats") + slog.Debug("cli stats", "args", args) section := "cli" command := "stats" diff --git a/cmd/cli_update.go b/cmd/cli_update.go index 1c0de1ef..e7a23e22 100644 --- a/cmd/cli_update.go +++ b/cmd/cli_update.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ CLI backend, to the latest version or the version specified. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("cli update") + slog.Debug("cli update", "args", args) section := "cli" command := "update" diff --git a/cmd/core_check.go b/cmd/core_check.go index 5109a98d..034e6483 100644 --- a/cmd/core_check.go +++ b/cmd/core_check.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ Home Assistant Core.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("core check") + slog.Debug("core check", "args", args) section := "core" command := "check" diff --git a/cmd/core_info.go b/cmd/core_info.go index 8f703a4f..ee09a9af 100644 --- a/cmd/core_info.go +++ b/cmd/core_info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ running on your Home Assistant system.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("core info") + slog.Debug("core info", "args", args) section := "core" command := "info" diff --git a/cmd/core_logs.go b/cmd/core_logs.go index cda81fb3..b0b32844 100644 --- a/cmd/core_logs.go +++ b/cmd/core_logs.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ running on your Home Assistant system.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("core logs") + slog.Debug("core logs", "args", args) section := "core" diff --git a/cmd/core_options.go b/cmd/core_options.go index 09e26bed..cd173a83 100644 --- a/cmd/core_options.go +++ b/cmd/core_options.go @@ -1,10 +1,10 @@ package cmd import ( + "log/slog" "strings" helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/pflag" ) @@ -21,7 +21,7 @@ instance running on your Home Assistant system.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("core options") + slog.Debug("core options", "args", args) section := "core" command := "options" diff --git a/cmd/core_rebuild.go b/cmd/core_rebuild.go index 41d952bf..5cf39414 100644 --- a/cmd/core_rebuild.go +++ b/cmd/core_rebuild.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Don't worry, this does not delete your config.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("core rebuild") + slog.Debug("core rebuild", "args", args) section := "core" command := "rebuild" diff --git a/cmd/core_restart.go b/cmd/core_restart.go index c61e243b..a304cb98 100644 --- a/cmd/core_restart.go +++ b/cmd/core_restart.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -17,7 +18,7 @@ Restart the Home Assistant Core instance running on your system`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("core restart") + slog.Debug("core restart", "args", args) section := "core" command := "restart" diff --git a/cmd/core_start.go b/cmd/core_start.go index 46e93265..f2686948 100644 --- a/cmd/core_start.go +++ b/cmd/core_start.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ your system. This, of course, only applies when it has been stopped.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("core start") + slog.Debug("core start", "args", args) section := "core" command := "start" diff --git a/cmd/core_stats.go b/cmd/core_stats.go index 25e62c45..1de98870 100644 --- a/cmd/core_stats.go +++ b/cmd/core_stats.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ It shows you how much CPU, memory, disk & network resources it uses.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("core stats") + slog.Debug("core stats", "args", args) section := "core" command := "stats" diff --git a/cmd/core_stop.go b/cmd/core_stop.go index 19d5fd39..00cb8847 100644 --- a/cmd/core_stop.go +++ b/cmd/core_stop.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ your system.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("core stop") + slog.Debug("core stop", "args", args) section := "core" command := "stop" diff --git a/cmd/core_update.go b/cmd/core_update.go index 117f925e..6f57466d 100644 --- a/cmd/core_update.go +++ b/cmd/core_update.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ running on your system to the latest version or the version specified.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("core update") + slog.Debug("core update", "args", args) section := "core" command := "update" diff --git a/cmd/dns_info.go b/cmd/dns_info.go index 2d7d6a85..94cce76d 100644 --- a/cmd/dns_info.go +++ b/cmd/dns_info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Shows information about the internally running Home Assistant DNS server ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("dns info") + slog.Debug("dns info", "args", args) section := "dns" command := "info" diff --git a/cmd/dns_logs.go b/cmd/dns_logs.go index afcc54e7..a2f91834 100644 --- a/cmd/dns_logs.go +++ b/cmd/dns_logs.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Allowing you to look at the log output generated by the Home Assistant DNS serve ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("dns logs") + slog.Debug("dns logs", "args", args) section := "dns" diff --git a/cmd/dns_options.go b/cmd/dns_options.go index 0dc49a54..4e598d3e 100644 --- a/cmd/dns_options.go +++ b/cmd/dns_options.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ running Home Assistant DNS server. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("dns options") + slog.Debug("dns options", "args", args) section := "dns" command := "options" @@ -28,7 +29,7 @@ running Home Assistant DNS server. options := make(map[string]any) servers, err := cmd.Flags().GetStringArray("servers") - log.WithField("servers", servers).Debug("servers") + slog.Debug("servers", "servers", servers) if len(servers) >= 1 && err == nil { options["servers"] = servers diff --git a/cmd/dns_reset.go b/cmd/dns_reset.go index 8dc6b1fb..b2f9e212 100644 --- a/cmd/dns_reset.go +++ b/cmd/dns_reset.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -14,7 +15,7 @@ var dnsResetCmd = &cobra.Command{ ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("dns reset") + slog.Debug("dns reset", "args", args) section := "dns" command := "reset" diff --git a/cmd/dns_restart.go b/cmd/dns_restart.go index 39e9792d..1376a7fe 100644 --- a/cmd/dns_restart.go +++ b/cmd/dns_restart.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -16,7 +17,7 @@ var dnsRestartCmd = &cobra.Command{ ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("dns restart") + slog.Debug("dns restart", "args", args) section := "dns" command := "restart" diff --git a/cmd/dns_stats.go b/cmd/dns_stats.go index 1eefd7f9..c264565a 100644 --- a/cmd/dns_stats.go +++ b/cmd/dns_stats.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ It shows you how much CPU, memory, disk & network resources it uses. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("dns stats") + slog.Debug("dns stats", "args", args) section := "dns" command := "stats" diff --git a/cmd/dns_update.go b/cmd/dns_update.go index 8425e035..f383099e 100644 --- a/cmd/dns_update.go +++ b/cmd/dns_update.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ DNS server, to the latest version or the version specified. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("dns update") + slog.Debug("dns update", "args", args) section := "dns" command := "update" diff --git a/cmd/docker_info.go b/cmd/docker_info.go index 6aa03d38..2f00cd90 100644 --- a/cmd/docker_info.go +++ b/cmd/docker_info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Shows information about the local Docker backend on the host system ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("docker info") + slog.Debug("docker info", "args", args) section := "docker" command := "info" diff --git a/cmd/docker_migrate_storage_driver.go b/cmd/docker_migrate_storage_driver.go index f06ee055..9c6f6dbb 100644 --- a/cmd/docker_migrate_storage_driver.go +++ b/cmd/docker_migrate_storage_driver.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -28,7 +29,7 @@ to complete the migration. }, Args: cobra.MaximumNArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("docker migrate-storage-driver") + slog.Debug("docker migrate-storage-driver", "args", args) section := "docker" command := "migrate-storage-driver" diff --git a/cmd/docker_options.go b/cmd/docker_options.go index e7854c2e..2d7fb6e8 100644 --- a/cmd/docker_options.go +++ b/cmd/docker_options.go @@ -2,10 +2,10 @@ package cmd import ( "fmt" + "log/slog" "strings" helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/pflag" ) @@ -23,7 +23,7 @@ docker backend running on your Home Assistant system.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("docker options") + slog.Debug("docker options", "args", args) section := "docker" command := "options" diff --git a/cmd/docker_registries.go b/cmd/docker_registries.go index f2569d55..6fb110ca 100644 --- a/cmd/docker_registries.go +++ b/cmd/docker_registries.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Manage private OCI registry server on the local Docker host. ha docker registries delete my-docker.example.com `, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("docker registries") + slog.Debug("docker registries", "args", args) section := "docker" command := "registries" diff --git a/cmd/docker_registries_add.go b/cmd/docker_registries_add.go index e87fa73d..6b7eeb8a 100644 --- a/cmd/docker_registries_add.go +++ b/cmd/docker_registries_add.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Add new login for the Docker OCI registry server. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("registries add") + slog.Debug("registries add", "args", args) section := "docker" command := "registries" @@ -49,7 +50,7 @@ Add new login for the Docker OCI registry server. } if len(options) > 0 { - log.WithField("options", options).Debug("Request body") + slog.Debug("Request body", "options", options) request.SetBody(options) } diff --git a/cmd/docker_registries_delete.go b/cmd/docker_registries_delete.go index 5cd970ff..f79c965e 100644 --- a/cmd/docker_registries_delete.go +++ b/cmd/docker_registries_delete.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Remove login for the Docker OCI registry server. ValidArgsFunction: dockerRegistriesDeleteCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("registries delete") + slog.Debug("registries delete", "args", args) section := "docker" command := "registries/{host}" diff --git a/cmd/hardware.go b/cmd/hardware.go index 0ec37e08..35662446 100644 --- a/cmd/hardware.go +++ b/cmd/hardware.go @@ -1,7 +1,8 @@ package cmd import ( - log "github.com/sirupsen/logrus" + "log/slog" + "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ audio devices and serial ports.`, } func init() { - log.Debug("Init hardware") + slog.Debug("Init hardware") // add cmd to root command rootCmd.AddCommand(hardwareCmd) diff --git a/cmd/hardware_audio.go b/cmd/hardware_audio.go index 5452b64d..19024f50 100644 --- a/cmd/hardware_audio.go +++ b/cmd/hardware_audio.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -16,7 +17,7 @@ The command provides information about audio devices available on your system.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("hardware info") + slog.Debug("hardware audio", "args", args) section := "hardware" command := "audio" diff --git a/cmd/hardware_info.go b/cmd/hardware_info.go index f6802226..697f1112 100644 --- a/cmd/hardware_info.go +++ b/cmd/hardware_info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ serial ports.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("hardware info") + slog.Debug("hardware info", "args", args) section := "hardware" command := "info" diff --git a/cmd/host.go b/cmd/host.go index 3e451636..a386eeb0 100644 --- a/cmd/host.go +++ b/cmd/host.go @@ -2,10 +2,10 @@ package cmd import ( "fmt" + "log/slog" "github.com/go-resty/resty/v2" "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -71,7 +71,7 @@ func processLogsFlags(section string, cmd *cobra.Command) (*resty.Request, error lines, _ := cmd.Flags().GetUint32("lines") if lines > 0 { rangeHeader := fmt.Sprintf("entries=:%d:", -(int(lines) - 1)) - log.WithField("value", rangeHeader).Debug("Range header") + slog.Debug("Range header", "value", rangeHeader) request.SetHeader("Range", rangeHeader) } diff --git a/cmd/host_disks_usage.go b/cmd/host_disks_usage.go index 59d8d8fe..45dcae98 100644 --- a/cmd/host_disks_usage.go +++ b/cmd/host_disks_usage.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ that Home Assistant is running on.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("host disks usage") + slog.Debug("host disks usage", "args", args) section := "host" command := "disks/default/usage" diff --git a/cmd/host_info.go b/cmd/host_info.go index 15817de0..a89ee0db 100644 --- a/cmd/host_info.go +++ b/cmd/host_info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ running on`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("host info") + slog.Debug("host info", "args", args) section := "host" command := "info" diff --git a/cmd/host_logs.go b/cmd/host_logs.go index 09167039..e7a8703e 100644 --- a/cmd/host_logs.go +++ b/cmd/host_logs.go @@ -1,10 +1,10 @@ package cmd import ( + "log/slog" "strings" helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -22,7 +22,7 @@ across services and boots. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("host logs") + slog.Debug("host logs", "args", args) section := "host" diff --git a/cmd/host_logs_boots.go b/cmd/host_logs_boots.go index 53765121..175713dd 100644 --- a/cmd/host_logs_boots.go +++ b/cmd/host_logs_boots.go @@ -1,10 +1,10 @@ package cmd import ( + "log/slog" "strings" helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -21,7 +21,7 @@ Show all values that can be used with the boot arg to find logs. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("host logs boots") + slog.Debug("host logs boots", "args", args) section := "host" command := "logs/boots" diff --git a/cmd/host_logs_identifiers.go b/cmd/host_logs_identifiers.go index 54c2cd41..1e05c87c 100644 --- a/cmd/host_logs_identifiers.go +++ b/cmd/host_logs_identifiers.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Show all values that can be used with the identifier arg to find logs. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("host logs identifiers") + slog.Debug("host logs identifiers", "args", args) section := "host" command := "logs/identifiers" diff --git a/cmd/host_options.go b/cmd/host_options.go index ebdafb82..ebe007ad 100644 --- a/cmd/host_options.go +++ b/cmd/host_options.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ your Home Assistant is running on.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("host options") + slog.Debug("host options", "args", args) section := "host" command := "options" diff --git a/cmd/host_reboot.go b/cmd/host_reboot.go index 260f5c4c..0a21d021 100644 --- a/cmd/host_reboot.go +++ b/cmd/host_reboot.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -17,7 +18,7 @@ Reboot the machine that your Home Assistant is running on.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("host reboot") + slog.Debug("host reboot", "args", args) section := "host" command := "reboot" diff --git a/cmd/host_reload.go b/cmd/host_reload.go index e2501596..b2ea52f3 100644 --- a/cmd/host_reload.go +++ b/cmd/host_reload.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ the internals of Home Assistant.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("host reload") + slog.Debug("host reload", "args", args) section := "host" command := "reload" diff --git a/cmd/host_shutdown.go b/cmd/host_shutdown.go index c1defe14..e08db99b 100644 --- a/cmd/host_shutdown.go +++ b/cmd/host_shutdown.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ WARNING: This is turning off the computer/device.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("host shutdown") + slog.Debug("host shutdown", "args", args) section := "host" command := "shutdown" diff --git a/cmd/info.go b/cmd/info.go index 3329b24e..c078c7d9 100644 --- a/cmd/info.go +++ b/cmd/info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -21,7 +22,7 @@ issues or when reporting one on GitHub. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("info") + slog.Debug("info", "args", args) section := "info" command := "" diff --git a/cmd/jobs_info.go b/cmd/jobs_info.go index d29ee9ca..70508db4 100644 --- a/cmd/jobs_info.go +++ b/cmd/jobs_info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ This command provides general information about the Home Assistant Job backend. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("jobs info") + slog.Debug("jobs info", "args", args) section := "jobs" command := "info" diff --git a/cmd/jobs_options.go b/cmd/jobs_options.go index e06e1e72..6aab174a 100644 --- a/cmd/jobs_options.go +++ b/cmd/jobs_options.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ Home Assistant Job Manager. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("jobs options") + slog.Debug("jobs options", "args", args) section := "jobs" command := "options" diff --git a/cmd/jobs_reset.go b/cmd/jobs_reset.go index 7e21246d..66dfbd7b 100644 --- a/cmd/jobs_reset.go +++ b/cmd/jobs_reset.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -14,7 +15,7 @@ var jobsResetCmd = &cobra.Command{ ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("jobs reset") + slog.Debug("jobs reset", "args", args) section := "jobs" command := "reset" diff --git a/cmd/mounts_add.go b/cmd/mounts_add.go index 5c240746..7b167fa2 100644 --- a/cmd/mounts_add.go +++ b/cmd/mounts_add.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Add and configure a new mount in Supervisor. ValidArgsFunction: mountsCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("mounts add") + slog.Debug("mounts add", "args", args) section := "mounts" command := "" @@ -40,7 +41,7 @@ Add and configure a new mount in Supervisor. mountFlagsToOptions(cmd, options) if len(options) > 0 { - log.WithField("options", options).Debug("Request body") + slog.Debug("Request body", "options", options) request.SetBody(options) } diff --git a/cmd/mounts_delete.go b/cmd/mounts_delete.go index 4b44db60..6b0116c7 100644 --- a/cmd/mounts_delete.go +++ b/cmd/mounts_delete.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Unmount and delete an existing mount from Supervisor. ValidArgsFunction: mountsCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("mounts delete") + slog.Debug("mounts delete", "args", args) section := "mounts" command := "{name}" diff --git a/cmd/mounts_info.go b/cmd/mounts_info.go index a02ceb28..bf58b2d3 100644 --- a/cmd/mounts_info.go +++ b/cmd/mounts_info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Shows information about the currently configured mounts in Supervisor ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("mounts info") + slog.Debug("mounts info", "args", args) section := "mounts" command := "" diff --git a/cmd/mounts_options.go b/cmd/mounts_options.go index 9cac4b03..cd3e864a 100644 --- a/cmd/mounts_options.go +++ b/cmd/mounts_options.go @@ -1,10 +1,10 @@ package cmd import ( + "log/slog" "strings" helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/pflag" ) @@ -22,7 +22,7 @@ Change value for options of mount manager in Supervisor. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("mounts options") + slog.Debug("mounts options", "args", args) section := "mounts" command := "options" diff --git a/cmd/mounts_reload.go b/cmd/mounts_reload.go index 04083579..7ff1fdbb 100644 --- a/cmd/mounts_reload.go +++ b/cmd/mounts_reload.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ the same configuration. ValidArgsFunction: mountsCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("mounts reload") + slog.Debug("mounts reload", "args", args) section := "mounts" command := "{name}/reload" diff --git a/cmd/mounts_update.go b/cmd/mounts_update.go index 0a37c48e..585e0e35 100644 --- a/cmd/mounts_update.go +++ b/cmd/mounts_update.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Update or change the configuration of an existing mount in Supervisor. ValidArgsFunction: mountsCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("mounts update") + slog.Debug("mounts update", "args", args) section := "mounts" command := "{name}" @@ -42,7 +43,7 @@ Update or change the configuration of an existing mount in Supervisor. mountFlagsToOptions(cmd, options) if len(options) > 0 { - log.WithField("options", options).Debug("Request body") + slog.Debug("Request body", "options", options) request.SetBody(options) } diff --git a/cmd/multicast_info.go b/cmd/multicast_info.go index 2e0ee270..8763416a 100644 --- a/cmd/multicast_info.go +++ b/cmd/multicast_info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Shows information about the internally running Home Assistant Multicast server ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("multicast info") + slog.Debug("multicast info", "args", args) section := "multicast" command := "info" diff --git a/cmd/multicast_logs.go b/cmd/multicast_logs.go index 1e5d99d0..4b12c31c 100644 --- a/cmd/multicast_logs.go +++ b/cmd/multicast_logs.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Allowing you to look at the log output generated by the Home Assistant Multicast ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("multicast logs") + slog.Debug("multicast logs", "args", args) section := "multicast" diff --git a/cmd/multicast_restart.go b/cmd/multicast_restart.go index e429b02c..ac9e18d0 100644 --- a/cmd/multicast_restart.go +++ b/cmd/multicast_restart.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -16,7 +17,7 @@ var multicastRestartCmd = &cobra.Command{ ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("multicast restart") + slog.Debug("multicast restart", "args", args) section := "multicast" command := "restart" diff --git a/cmd/multicast_stats.go b/cmd/multicast_stats.go index 5b2e7291..69ce4eed 100644 --- a/cmd/multicast_stats.go +++ b/cmd/multicast_stats.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ It shows you how much CPU, memory, disk & network resources it uses. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("multicast stats") + slog.Debug("multicast stats", "args", args) section := "multicast" command := "stats" diff --git a/cmd/multicast_update.go b/cmd/multicast_update.go index 73b5d017..204a796a 100644 --- a/cmd/multicast_update.go +++ b/cmd/multicast_update.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ Multicast server, to the latest version or the version specified. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("multicast update") + slog.Debug("multicast update", "args", args) section := "multicast" command := "update" diff --git a/cmd/network.go b/cmd/network.go index 2eccc212..03cd8b2c 100644 --- a/cmd/network.go +++ b/cmd/network.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ system network IP address, set connection options or join a Wi-Fi network.`, } func init() { - log.Debug("Init network") + slog.Debug("Init network") rootCmd.AddCommand(networkCmd) } diff --git a/cmd/network_info.go b/cmd/network_info.go index 4655fb26..fb5f3dc3 100644 --- a/cmd/network_info.go +++ b/cmd/network_info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ Shows information about the host network and interfaces or only from a specific ValidArgsFunction: networkInterfaceCompletions, Args: cobra.MaximumNArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("network info") + slog.Debug("network info", "args", args) section := "network" command := "info" diff --git a/cmd/network_reload.go b/cmd/network_reload.go index b265c01d..03383bf1 100644 --- a/cmd/network_reload.go +++ b/cmd/network_reload.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Reload information about the host network and interfaces. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("network reload") + slog.Debug("network reload", "args", args) section := "network" command := "reload" diff --git a/cmd/network_scan.go b/cmd/network_scan.go index 7ad6350f..59536d85 100644 --- a/cmd/network_scan.go +++ b/cmd/network_scan.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ This function works only on a wireless interface! ValidArgsFunction: networkInterfaceCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("network scan") + slog.Debug("network scan", "args", args) section := "network" command := "interface/{interface}/accesspoints" diff --git a/cmd/network_update.go b/cmd/network_update.go index 3af3c6ea..4f967e56 100644 --- a/cmd/network_update.go +++ b/cmd/network_update.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Update network interface settings of a specific adapter. ValidArgsFunction: networkInterfaceCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("network update") + slog.Debug("network update", "args", args) section := "network" command := "interface/{interface}/update" @@ -56,7 +57,7 @@ Update network interface settings of a specific adapter. options["enabled"] = !disabled } - log.WithField("options", options).Debug("Request body") + slog.Debug("Request body", "options", options) request.SetBody(options) resp, err := request.Post(url) diff --git a/cmd/network_vlan.go b/cmd/network_vlan.go index ac55dc85..16a98187 100644 --- a/cmd/network_vlan.go +++ b/cmd/network_vlan.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ This function works only on an ethernet interface! ValidArgsFunction: networkInterfaceCompletions, Args: cobra.ExactArgs(2), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("network vlan") + slog.Debug("network vlan", "args", args) section := "network" command := "interface/{interface}/vlan/{vlan}" @@ -52,7 +53,7 @@ This function works only on an ethernet interface! helperMdnsConfig(cmd, options) if len(options) > 0 { - log.WithField("options", options).Debug("Request body") + slog.Debug("Request body", "options", options) request.SetBody(options) } diff --git a/cmd/observer_info.go b/cmd/observer_info.go index 16d4be72..9865650e 100644 --- a/cmd/observer_info.go +++ b/cmd/observer_info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ Shows information about the internally running Home Assistant observer ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("observer info") + slog.Debug("observer info", "args", args) section := "observer" command := "info" diff --git a/cmd/observer_stats.go b/cmd/observer_stats.go index 2a141c25..444bf7df 100644 --- a/cmd/observer_stats.go +++ b/cmd/observer_stats.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ It shows you how much CPU, memory, disk & network resources it uses. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("observer stats") + slog.Debug("observer stats", "args", args) section := "observer" command := "stats" diff --git a/cmd/observer_update.go b/cmd/observer_update.go index 00820100..e4e7adfd 100644 --- a/cmd/observer_update.go +++ b/cmd/observer_update.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ observer, to the latest version or the version specified. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("observer update") + slog.Debug("observer update", "args", args) section := "observer" command := "update" diff --git a/cmd/os_boards_green.go b/cmd/os_boards_green.go index c0255436..7d7fae11 100644 --- a/cmd/os_boards_green.go +++ b/cmd/os_boards_green.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ Assistant is running on.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("os boards green") + slog.Debug("os boards green", "args", args) section := "os" command := "boards/green" diff --git a/cmd/os_boards_green_options.go b/cmd/os_boards_green_options.go index 98961a19..f5f9c81c 100644 --- a/cmd/os_boards_green_options.go +++ b/cmd/os_boards_green_options.go @@ -1,10 +1,10 @@ package cmd import ( + "log/slog" "strings" helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +20,7 @@ Assistant is running on.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("os boards green options") + slog.Debug("os boards green options", "args", args) section := "os" command := "boards/green" diff --git a/cmd/os_boards_yellow.go b/cmd/os_boards_yellow.go index 7901e922..ead9f46b 100644 --- a/cmd/os_boards_yellow.go +++ b/cmd/os_boards_yellow.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ Assistant is running on.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("os boards yellow") + slog.Debug("os boards yellow", "args", args) section := "os" command := "boards/yellow" diff --git a/cmd/os_boards_yellow_options.go b/cmd/os_boards_yellow_options.go index e3ed3a98..f86e3afd 100644 --- a/cmd/os_boards_yellow_options.go +++ b/cmd/os_boards_yellow_options.go @@ -1,10 +1,10 @@ package cmd import ( + "log/slog" "strings" helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +20,7 @@ Assistant is running on. A host reboot is required for changes to take effect.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("os boards yellow options") + slog.Debug("os boards yellow options", "args", args) section := "os" command := "boards/yellow" diff --git a/cmd/os_boot_slot.go b/cmd/os_boot_slot.go index e25542a0..73fddd6a 100644 --- a/cmd/os_boot_slot.go +++ b/cmd/os_boot_slot.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -21,7 +22,7 @@ an OS update without making more changes to the system. ValidArgsFunction: osBootSlotCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("os boot-slot") + slog.Debug("os boot-slot", "args", args) section := "os" command := "boot-slot" diff --git a/cmd/os_config_swap_info.go b/cmd/os_config_swap_info.go index 351fdd4f..d3191d7d 100644 --- a/cmd/os_config_swap_info.go +++ b/cmd/os_config_swap_info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -17,7 +18,7 @@ This command allows you to see how swap is used by the Home Assistant OS.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("os config swap info") + slog.Debug("os config swap info", "args", args) section := "os" command := "config/swap" diff --git a/cmd/os_config_swap_options.go b/cmd/os_config_swap_options.go index fefe7bcb..31a70569 100644 --- a/cmd/os_config_swap_options.go +++ b/cmd/os_config_swap_options.go @@ -2,10 +2,10 @@ package cmd import ( "fmt" + "log/slog" "strconv" helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +20,7 @@ This command allows you to override how the Home Assistant OS uses swap.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("os config swap options") + slog.Debug("os config swap options", "args", args) section := "os" command := "config/swap" diff --git a/cmd/os_datadisk_list.go b/cmd/os_datadisk_list.go index 12437ca7..9c071764 100644 --- a/cmd/os_datadisk_list.go +++ b/cmd/os_datadisk_list.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ This command provides general information about available Harddisk for using wit ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("os datadisk list") + slog.Debug("os datadisk list", "args", args) section := "os" command := "datadisk/list" diff --git a/cmd/os_datadisk_move.go b/cmd/os_datadisk_move.go index 76d797ad..3e58ec8c 100644 --- a/cmd/os_datadisk_move.go +++ b/cmd/os_datadisk_move.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -25,7 +26,7 @@ data partition to a new harddisk. The system reboots afterwards! }, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("os datadisk move") + slog.Debug("os datadisk move", "args", args) section := "os" command := "datadisk/move" diff --git a/cmd/os_datadisk_wipe.go b/cmd/os_datadisk_wipe.go index c2e2d212..b8699802 100644 --- a/cmd/os_datadisk_wipe.go +++ b/cmd/os_datadisk_wipe.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -31,7 +32,7 @@ only work on some locations. For example, the Operating System CLI. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("os datadisk wipe") + slog.Debug("os datadisk wipe", "args", args) section := "os" command := "datadisk/wipe" diff --git a/cmd/os_import.go b/cmd/os_import.go index 589a2f91..d8b2866c 100644 --- a/cmd/os_import.go +++ b/cmd/os_import.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ configuration to load for the Home Assistant Operating System. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("os import") + slog.Debug("os import", "args", args) section := "os" command := "config/sync" diff --git a/cmd/os_info.go b/cmd/os_info.go index 6842d966..79d79933 100644 --- a/cmd/os_info.go +++ b/cmd/os_info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ This command provides general information about the running Home Assistant Opera ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("os info") + slog.Debug("os info", "args", args) section := "os" command := "info" diff --git a/cmd/os_update.go b/cmd/os_update.go index 4838bb3b..eacaecdb 100644 --- a/cmd/os_update.go +++ b/cmd/os_update.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -21,7 +22,7 @@ Operating System to the latest version or the version specified. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("os update") + slog.Debug("os update", "args", args) section := "os" command := "update" diff --git a/cmd/refresh_updates.go b/cmd/refresh_updates.go index 9a089798..62eaee17 100644 --- a/cmd/refresh_updates.go +++ b/cmd/refresh_updates.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ This command reloads information about app repositories and fetches new version ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("refresh_updates") + slog.Debug("refresh_updates", "args", args) section := "refresh_updates" command := "" diff --git a/cmd/resolution_check_options.go b/cmd/resolution_check_options.go index 0eebda91..722f0ad3 100644 --- a/cmd/resolution_check_options.go +++ b/cmd/resolution_check_options.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -17,7 +18,7 @@ This command allows to apply options to an specific check managed by the system. ValidArgsFunction: resolutionCheckCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("check options") + slog.Debug("check options", "args", args) section := "resolution" command := "check/{check}/options" @@ -44,7 +45,7 @@ This command allows to apply options to an specific check managed by the system. } if len(options) > 0 { - log.WithField("options", options).Debug("Request body") + slog.Debug("Request body", "options", options) request.SetBody(options) } resp, err := request.Post(url) diff --git a/cmd/resolution_check_run.go b/cmd/resolution_check_run.go index 14cba82d..9d166fe9 100644 --- a/cmd/resolution_check_run.go +++ b/cmd/resolution_check_run.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -17,7 +18,7 @@ This command executes an backend check immediately on the system.`, ValidArgsFunction: resolutionCheckCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("check run") + slog.Debug("check run", "args", args) section := "resolution" command := "check/{check}/run" diff --git a/cmd/resolution_healthcheck.go b/cmd/resolution_healthcheck.go index b83771d0..a49f19a6 100644 --- a/cmd/resolution_healthcheck.go +++ b/cmd/resolution_healthcheck.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ are still around and try to fix it again.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("resolution") + slog.Debug("resolution", "args", args) section := "resolution" command := "healthcheck" diff --git a/cmd/resolution_info.go b/cmd/resolution_info.go index e27832b4..b599dcb2 100644 --- a/cmd/resolution_info.go +++ b/cmd/resolution_info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -17,7 +18,7 @@ This command provides general information about the issues, suggestion and the s ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("resolution") + slog.Debug("resolution", "args", args) section := "resolution" command := "info" diff --git a/cmd/resolution_issue_dismiss.go b/cmd/resolution_issue_dismiss.go index 016e170f..2be706fd 100644 --- a/cmd/resolution_issue_dismiss.go +++ b/cmd/resolution_issue_dismiss.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -17,7 +18,7 @@ This command allows dismissing issues reported by the system.`, ValidArgsFunction: resolutionIssueCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("issue dismiss") + slog.Debug("issue dismiss", "args", args) section := "resolution" command := "issue/{issue}" diff --git a/cmd/resolution_issue_suggestions.go b/cmd/resolution_issue_suggestions.go index 798a19c1..0c9ac8c1 100644 --- a/cmd/resolution_issue_suggestions.go +++ b/cmd/resolution_issue_suggestions.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -17,7 +18,7 @@ This command returns suggestions which resolve an issue when applied.`, ValidArgsFunction: resolutionIssueCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("issue suggestions") + slog.Debug("issue suggestions", "args", args) section := "resolution" command := "issue/{issue}/suggestions" diff --git a/cmd/resolution_suggestion_apply.go b/cmd/resolution_suggestion_apply.go index dacf86eb..81902dfb 100644 --- a/cmd/resolution_suggestion_apply.go +++ b/cmd/resolution_suggestion_apply.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -17,7 +18,7 @@ This command allow to apply an suggestion reported by the System.`, ValidArgsFunction: resolutionSuggestionCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("suggestion dismiss") + slog.Debug("suggestion apply", "args", args) section := "resolution" command := "suggestion/{suggestion}" diff --git a/cmd/resolution_suggestion_dismiss.go b/cmd/resolution_suggestion_dismiss.go index bfea92a4..b3c376db 100644 --- a/cmd/resolution_suggestion_dismiss.go +++ b/cmd/resolution_suggestion_dismiss.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -17,7 +18,7 @@ This command allows dismissing a suggestion reported by the system.`, ValidArgsFunction: resolutionSuggestionCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("suggestion dismiss") + slog.Debug("suggestion dismiss", "args", args) section := "resolution" command := "suggestion/{suggestion}" diff --git a/cmd/root.go b/cmd/root.go index 2511ef14..a05122f1 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -2,6 +2,7 @@ package cmd import ( "fmt" + "log/slog" "os" "path" "strings" @@ -10,7 +11,6 @@ import ( helper "github.com/home-assistant/cli/client" "github.com/home-assistant/cli/spinner" homedir "github.com/mitchellh/go-homedir" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "github.com/spf13/viper" "golang.org/x/term" @@ -37,10 +37,9 @@ The Home Assistant CLI is a small and simple command line utility that allows you to control and configure different aspects of Home Assistant`, PersistentPreRun: func(cmd *cobra.Command, args []string) { // set loglevel if possible - logrusLevel, err := log.ParseLevel(viper.GetString("log-level")) - - if err == nil { - log.SetLevel(logrusLevel) + var level slog.Level + if level.UnmarshalText([]byte(viper.GetString("log-level"))) == nil { + slog.SetLogLoggerLevel(level) } helper.RawJSON = viper.GetBool("raw-json") @@ -51,14 +50,14 @@ you to control and configure different aspects of Home Assistant`, ProgressSpinner.Writer = os.Stderr } - log.WithFields(log.Fields{ - "apiToken": viper.GetString("api-token"), - "cfgFile": viper.GetString("config"), - "endpoint": viper.GetString("endpoint"), - "logLevel": viper.GetString("log-level"), - "noProgress": viper.GetBool("no-progress"), - "rawJSON": viper.GetBool("raw-json"), - }).Debugln("Debug flags") + slog.Debug("Debug flags", + "apiToken", viper.GetString("api-token"), + "cfgFile", viper.GetString("config"), + "endpoint", viper.GetString("endpoint"), + "logLevel", viper.GetString("log-level"), + "noProgress", viper.GetBool("no-progress"), + "rawJSON", viper.GetBool("raw-json"), + ) }, PersistentPostRun: func(cmd *cobra.Command, args []string) { if ProgressSpinner.Active() { @@ -81,18 +80,19 @@ func init() { rootCmd.PersistentFlags().StringVar(&cfgFile, "config", "", "Optional config file (default is $HOME/.homeassistant.yaml)") rootCmd.PersistentFlags().StringVar(&endPoint, "endpoint", "", "Endpoint for Home Assistant Supervisor (default is 'supervisor')") - rootCmd.PersistentFlags().StringVar(&logLevel, "log-level", "", "Log level (defaults to Warn)") + rootCmd.PersistentFlags().StringVar(&logLevel, "log-level", "", "Log level (defaults to "+slog.LevelWarn.String()+")") rootCmd.PersistentFlags().StringVar(&apiToken, "api-token", "", "Home Assistant Supervisor API token") rootCmd.PersistentFlags().BoolVar(&rawJSON, "raw-json", false, "Output raw JSON from the API") rootCmd.PersistentFlags().BoolVar(&noProgress, "no-progress", false, "Disable the progress spinner") rootCmd.RegisterFlagCompletionFunc("endpoint", cobra.NoFileCompletions) rootCmd.RegisterFlagCompletionFunc("log-level", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) { - vals := make([]string, 0, len(log.AllLevels)) - for _, lvl := range log.AllLevels { - vals = append(vals, lvl.String()) - } - return vals, cobra.ShellCompDirectiveNoFileComp + return []string{ + slog.LevelDebug.String(), + slog.LevelInfo.String(), + slog.LevelWarn.String(), + slog.LevelError.String(), + }, cobra.ShellCompDirectiveNoFileComp }) rootCmd.RegisterFlagCompletionFunc("api-token", cobra.NoFileCompletions) rootCmd.RegisterFlagCompletionFunc("raw-json", boolCompletions) @@ -125,10 +125,9 @@ func initConfig() { viper.BindEnv("api-token", "SUPERVISOR_TOKEN") // set loglevel if possible - logLevel, err := log.ParseLevel(viper.GetString("log-level")) - - if err == nil { - log.SetLevel(logLevel) + var level slog.Level + if level.UnmarshalText([]byte(viper.GetString("log-level"))) == nil { + slog.SetLogLoggerLevel(level) } if cfgFile != "" { @@ -144,15 +143,15 @@ func initConfig() { // Search config in home directory with name ".homeassistant" (without extension). viper.AddConfigPath(home) - log.WithField("homedir", home).Debug("Adding homedir to searchpath") + slog.Debug("Adding homedir to searchpath", "homedir", home) viper.SetConfigName(".homeassistant") } // If a config file is found, read it in. if err := viper.ReadInConfig(); err == nil { - log.WithField("configfile", viper.ConfigFileUsed()).Info("Using configfile") + slog.Info("Using configfile", "configfile", viper.ConfigFileUsed()) } else { - log.Info("No configfile found") + slog.Info("No configfile found") } } diff --git a/cmd/security_info.go b/cmd/security_info.go index 8efd77d8..1751107d 100644 --- a/cmd/security_info.go +++ b/cmd/security_info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ This command provides general information about the Home Assistant Security back ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("security info") + slog.Debug("security info", "args", args) section := "security" command := "info" diff --git a/cmd/security_integrity.go b/cmd/security_integrity.go index 95c0d7b3..07a5f8b9 100644 --- a/cmd/security_integrity.go +++ b/cmd/security_integrity.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ This need content trust to be enabled.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("security") + slog.Debug("security integrity", "args", args) section := "security" command := "integrity" diff --git a/cmd/security_options.go b/cmd/security_options.go index d33fe696..d7596959 100644 --- a/cmd/security_options.go +++ b/cmd/security_options.go @@ -1,10 +1,10 @@ package cmd import ( + "log/slog" "strings" helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -22,7 +22,7 @@ Home Assistant Security backend. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("security options") + slog.Debug("security options", "args", args) section := "security" command := "options" diff --git a/cmd/store.go b/cmd/store.go index d5e0cd5b..1f2657e4 100644 --- a/cmd/store.go +++ b/cmd/store.go @@ -1,10 +1,11 @@ package cmd import ( + "log/slog" + "strings" helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -22,7 +23,7 @@ for managing stores that provide additional apps.`, ha store delete 94cfad5a ha store reload`, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("store") + slog.Debug("store", "args", args) section := "store" command := "" @@ -38,7 +39,7 @@ for managing stores that provide additional apps.`, } func init() { - log.Debug("Init store") + slog.Debug("Init store") rootCmd.AddCommand(storeCmd) } diff --git a/cmd/store_apps.go b/cmd/store_apps.go index c0868d90..5324a760 100644 --- a/cmd/store_apps.go +++ b/cmd/store_apps.go @@ -1,11 +1,11 @@ package cmd import ( + "log/slog" "os" "strings" helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -28,7 +28,7 @@ commands for installing or update them.`, rootCmd.PersistentPreRun(cmd, args) }, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("store apps") + slog.Debug("store apps", "args", args) section := "store" command := "addons" diff --git a/cmd/store_apps_install.go b/cmd/store_apps_install.go index 013a0e71..e6934a6a 100644 --- a/cmd/store_apps_install.go +++ b/cmd/store_apps_install.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ This command allows you to install a Home Assistant app from the commandline. ValidArgsFunction: storeAppCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("store apps install") + slog.Debug("store apps install", "args", args) section := "store" command := "addons/{slug}/install" diff --git a/cmd/store_apps_update.go b/cmd/store_apps_update.go index 01f125f7..ceacaf0e 100644 --- a/cmd/store_apps_update.go +++ b/cmd/store_apps_update.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ It is currently not possible to upgrade/downgrade to a specific version. ValidArgsFunction: storeAppCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("store apps update") + slog.Debug("store apps update", "args", args) section := "store" command := "addons/{slug}/update" @@ -51,7 +52,7 @@ It is currently not possible to upgrade/downgrade to a specific version. } if len(options) > 0 { - log.WithField("options", options).Debug("Request body") + slog.Debug("Request body", "options", options) request.SetBody(options) } diff --git a/cmd/store_reload.go b/cmd/store_reload.go index bf18a27a..5d358c74 100644 --- a/cmd/store_reload.go +++ b/cmd/store_reload.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -22,7 +23,7 @@ an app is released, but not yet available as an upgrade in Home Assistant. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("store reload") + slog.Debug("store reload", "args", args) section := "store" command := "reload" diff --git a/cmd/store_repositories_add.go b/cmd/store_repositories_add.go index 2605b029..66753c18 100644 --- a/cmd/store_repositories_add.go +++ b/cmd/store_repositories_add.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ ha store add https://github.com/home-assistant/addons-example ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("store add") + slog.Debug("store add", "args", args) section := "store" command := "repositories" @@ -39,7 +40,7 @@ ha store add https://github.com/home-assistant/addons-example options["repository"] = repository if len(options) > 0 { - log.WithField("options", options).Debug("Request body") + slog.Debug("Request body", "options", options) request.SetBody(options) } diff --git a/cmd/store_repositories_delete.go b/cmd/store_repositories_delete.go index 23f7ec08..d7adfe87 100644 --- a/cmd/store_repositories_delete.go +++ b/cmd/store_repositories_delete.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -19,7 +20,7 @@ ha store delete 94cfad5a ValidArgsFunction: storeRepositoriesCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("store delete") + slog.Debug("store delete", "args", args) section := "store" command := "repositories/{slug}" diff --git a/cmd/store_repositories_repair.go b/cmd/store_repositories_repair.go index 35cec33c..dd01d32f 100644 --- a/cmd/store_repositories_repair.go +++ b/cmd/store_repositories_repair.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ ha store repair 94cfad5a ValidArgsFunction: storeRepositoriesCompletions, Args: cobra.ExactArgs(1), Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("store repair") + slog.Debug("store repair", "args", args) section := "store" command := "repositories/{slug}/repair" diff --git a/cmd/supervisor.go b/cmd/supervisor.go index dc2ed423..c09bbd61 100644 --- a/cmd/supervisor.go +++ b/cmd/supervisor.go @@ -1,7 +1,8 @@ package cmd import ( - log "github.com/sirupsen/logrus" + "log/slog" + "github.com/spf13/cobra" ) @@ -21,6 +22,6 @@ Home Assistant Supervisor.`, } func init() { - log.Debug("Init supervisor") + slog.Debug("Init supervisor") rootCmd.AddCommand(supervisorCmd) } diff --git a/cmd/supervisor_available_updates.go b/cmd/supervisor_available_updates.go index ef516c89..92909de8 100644 --- a/cmd/supervisor_available_updates.go +++ b/cmd/supervisor_available_updates.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -17,7 +18,7 @@ This command provides you information about available updates.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("supervisor available-updates") + slog.Debug("supervisor available-updates", "args", args) section := "supervisor" command := "available_updates" diff --git a/cmd/supervisor_info.go b/cmd/supervisor_info.go index 6d1013d4..4a9ba159 100644 --- a/cmd/supervisor_info.go +++ b/cmd/supervisor_info.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ Supervisor currently knows.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("supervisor info") + slog.Debug("supervisor info", "args", args) section := "supervisor" command := "info" diff --git a/cmd/supervisor_logs.go b/cmd/supervisor_logs.go index 7cc0aab6..3de1e63d 100644 --- a/cmd/supervisor_logs.go +++ b/cmd/supervisor_logs.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ Supervisor running on your Home Assistant system.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("supervisor logs") + slog.Debug("supervisor logs", "args", args) section := "supervisor" diff --git a/cmd/supervisor_options.go b/cmd/supervisor_options.go index 046db6e4..a16c557c 100644 --- a/cmd/supervisor_options.go +++ b/cmd/supervisor_options.go @@ -1,10 +1,10 @@ package cmd import ( + "log/slog" "strings" helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +20,7 @@ Supervisor running on your Home Assistant system.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("supervisor options") + slog.Debug("supervisor options", "args", args) section := "supervisor" command := "options" diff --git a/cmd/supervisor_reload.go b/cmd/supervisor_reload.go index 5f86f2a7..e51665a5 100644 --- a/cmd/supervisor_reload.go +++ b/cmd/supervisor_reload.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ all data it currently has, including checking for updates.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("supervisor reload") + slog.Debug("supervisor reload", "args", args) section := "supervisor" command := "reload" diff --git a/cmd/supervisor_repair.go b/cmd/supervisor_repair.go index 5b4ddacb..7a526e7c 100644 --- a/cmd/supervisor_repair.go +++ b/cmd/supervisor_repair.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ the Home Assistant Supervisor will try to resolve these. ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("supervisor repair") + slog.Debug("supervisor repair", "args", args) section := "supervisor" command := "repair" diff --git a/cmd/supervisor_restart.go b/cmd/supervisor_restart.go index ba7f4781..8824b4c1 100644 --- a/cmd/supervisor_restart.go +++ b/cmd/supervisor_restart.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -17,7 +18,7 @@ Restart the Supervisor internal, this can solve healthy issues.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("supervisor restart") + slog.Debug("supervisor restart", "args", args) section := "supervisor" command := "restart" diff --git a/cmd/supervisor_stats.go b/cmd/supervisor_stats.go index 20eae915..10b75541 100644 --- a/cmd/supervisor_stats.go +++ b/cmd/supervisor_stats.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -18,7 +19,7 @@ It shows you how much CPU, memory, disk & network resources it uses.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("supervisor stats") + slog.Debug("supervisor stats", "args", args) section := "supervisor" command := "stats" diff --git a/cmd/supervisor_update.go b/cmd/supervisor_update.go index a5deccfb..2592d189 100644 --- a/cmd/supervisor_update.go +++ b/cmd/supervisor_update.go @@ -1,8 +1,9 @@ package cmd import ( + "log/slog" + helper "github.com/home-assistant/cli/client" - log "github.com/sirupsen/logrus" "github.com/spf13/cobra" ) @@ -20,7 +21,7 @@ or the version specified.`, ValidArgsFunction: cobra.NoFileCompletions, Args: cobra.NoArgs, Run: func(cmd *cobra.Command, args []string) { - log.WithField("args", args).Debug("supervisor update") + slog.Debug("supervisor update", "args", args) section := "supervisor" command := "update" diff --git a/go.mod b/go.mod index 90993ca0..ff013104 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,6 @@ require ( github.com/ghodss/yaml v1.0.0 github.com/go-resty/resty/v2 v2.17.1 github.com/mitchellh/go-homedir v1.1.0 - github.com/sirupsen/logrus v1.9.4 github.com/spf13/cobra v1.10.2 github.com/spf13/pflag v1.0.10 github.com/spf13/viper v1.21.0 diff --git a/go.sum b/go.sum index 5f68caf0..14f87cb6 100644 --- a/go.sum +++ b/go.sum @@ -30,8 +30,6 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sagikazarmark/locafero v0.11.0 h1:1iurJgmM9G3PA/I+wWYIOw/5SyBtxapeHDcg+AAIFXc= github.com/sagikazarmark/locafero v0.11.0/go.mod h1:nVIGvgyzw595SUSUE6tvCp3YYTeHs15MvlmU87WwIik= -github.com/sirupsen/logrus v1.9.4 h1:TsZE7l11zFCLZnZ+teH4Umoq5BhEIfIzfRDZ1Uzql2w= -github.com/sirupsen/logrus v1.9.4/go.mod h1:ftWc9WdOfJ0a92nsE2jF5u5ZwH8Bv2zdeOC42RjbV2g= github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 h1:+jumHNA0Wrelhe64i8F6HNlS8pkoyMv5sreGx2Ry5Rw= github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8/go.mod h1:3n1Cwaq1E1/1lhQhtRK2ts/ZwZEhjcQeJQ1RuC6Q/8U= github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I= diff --git a/main.go b/main.go index 7d5ba434..9954c6a3 100644 --- a/main.go +++ b/main.go @@ -1,15 +1,15 @@ package main import ( + "log/slog" "os" "github.com/home-assistant/cli/cmd" - log "github.com/sirupsen/logrus" ) func main() { // Only log the warning severity or above. - log.SetLevel(log.WarnLevel) + slog.SetLogLoggerLevel(slog.LevelWarn) defer func() { if cmd.ExitWithError { os.Exit(1)