From 6a7220be0c6bba5d8136269ee651f4e3b43997ad Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Quentin=20Guid=C3=A9e?= Date: Sun, 10 Sep 2023 15:30:42 -0400 Subject: [PATCH] logger Default alias --- adapter/instance_fs.go | 14 +++++++------- adapter/instance_logs_fs.go | 10 +++++----- adapter/package_fs.go | 2 +- adapter/proxy_fs.go | 8 ++++---- adapter/runner_docker.go | 22 +++++++++++----------- adapter/runner_fs.go | 4 ++-- adapter/service_fs.go | 2 +- adapter/settings_fs.go | 6 +++--- init.go | 12 ++++++------ pkg/ginutils/logger.go | 4 ++-- pkg/log/log.go | 22 +++++++++++++++++++++- pkg/storage/storage.go | 6 +++--- pkg/vdownloader/download.go | 2 +- router/instance.go | 6 +++--- router/instances.go | 4 ++-- router/packages.go | 10 +++++----- router/router.go | 12 ++++++------ services/instance.go | 20 ++++++++++---------- services/notifications.go | 2 +- services/proxy.go | 8 ++++---- services/update.go | 16 ++++++++-------- 21 files changed, 106 insertions(+), 86 deletions(-) diff --git a/adapter/instance_fs.go b/adapter/instance_fs.go index 57b513cc..298faf05 100644 --- a/adapter/instance_fs.go +++ b/adapter/instance_fs.go @@ -36,7 +36,7 @@ func NewInstanceFSAdapter() types.InstanceAdapterPort { err := os.MkdirAll(adapter.instancesPath, os.ModePerm) if err != nil && !os.IsExist(err) { - log.Default.Error(err, + log.Error(err, vlog.String("message", "failed to create directory"), vlog.String("path", adapter.instancesPath), ) @@ -108,7 +108,7 @@ func (a *InstanceFSAdapter) LoadSettings(i *types.Instance) error { settingsBytes, err := os.ReadFile(settingsPath) if errors.Is(err, os.ErrNotExist) { - log.Default.Warn("instance_settings.json not found. using default.") + log.Warn("instance_settings.json not found. using default.") } else if err != nil { return err } else { @@ -124,7 +124,7 @@ func (a *InstanceFSAdapter) LoadSettings(i *types.Instance) error { func (a *InstanceFSAdapter) ReadService(instancePath string) (types.Service, error) { data, err := os.ReadFile(path.Join(instancePath, ".vertex", "service.yml")) if err != nil { - log.Default.Warn("'.vertex/service.yml' file not found", + log.Warn("'.vertex/service.yml' file not found", vlog.String("path", path.Dir(instancePath)), ) } @@ -182,27 +182,27 @@ func (a *InstanceFSAdapter) LoadEnv(i *types.Instance) error { func (a *InstanceFSAdapter) Reload(load func(uuid uuid.UUID)) { entries, err := os.ReadDir(a.instancesPath) if err != nil { - log.Default.Error(err) + log.Error(err) os.Exit(1) } for _, entry := range entries { info, err := entry.Info() if err != nil { - log.Default.Error(err) + log.Error(err) continue } isInstance := entry.IsDir() || info.Mode()&os.ModeSymlink != 0 if isInstance { - log.Default.Info("found instance", + log.Info("found instance", vlog.String("uuid", entry.Name()), ) id, err := uuid.Parse(entry.Name()) if err != nil { - log.Default.Error(err) + log.Error(err) continue } diff --git a/adapter/instance_logs_fs.go b/adapter/instance_logs_fs.go index f6b8f713..0a2ac178 100644 --- a/adapter/instance_logs_fs.go +++ b/adapter/instance_logs_fs.go @@ -75,7 +75,7 @@ func (a *InstanceLogsFSAdapter) Close(uuid uuid.UUID) error { func (a *InstanceLogsFSAdapter) Push(uuid uuid.UUID, line types.LogLine) { l, err := a.getLogger(uuid) if err != nil { - log.Default.Error(err) + log.Error(err) return } l.currentLine += 1 @@ -86,7 +86,7 @@ func (a *InstanceLogsFSAdapter) Push(uuid uuid.UUID, line types.LogLine) { _, err = fmt.Fprintf(l.file, "%s\n", line.Message) if err != nil { - log.Default.Error(err) + log.Error(err) } } @@ -127,17 +127,17 @@ func (a *InstanceLogsFSAdapter) startCron() { for id := range a.loggers { err := a.Close(id) if err != nil { - log.Default.Error(err) + log.Error(err) continue } err = a.Open(id) if err != nil { - log.Default.Error(err) + log.Error(err) } } }) if err != nil { - log.Default.Error(err) + log.Error(err) return } s.StartAsync() diff --git a/adapter/package_fs.go b/adapter/package_fs.go index e434642d..31822b70 100644 --- a/adapter/package_fs.go +++ b/adapter/package_fs.go @@ -45,7 +45,7 @@ func NewPackageFSAdapter(params *PackageFSAdapterParams) types.PackageAdapterPor err := adapter.Reload() if err != nil { - log.Default.Error(fmt.Errorf("failed to reload services: %v", err)) + log.Error(fmt.Errorf("failed to reload services: %v", err)) } return adapter } diff --git a/adapter/proxy_fs.go b/adapter/proxy_fs.go index 7bb0a3e8..fb475b3c 100644 --- a/adapter/proxy_fs.go +++ b/adapter/proxy_fs.go @@ -32,7 +32,7 @@ func NewProxyFSAdapter(params *ProxyFSAdapterParams) types.ProxyAdapterPort { err := os.MkdirAll(params.proxyPath, os.ModePerm) if err != nil && !os.IsExist(err) { - log.Default.Error(err, + log.Error(err, vlog.String("message", "failed to create directory"), vlog.String("path", params.proxyPath), ) @@ -67,15 +67,15 @@ func (a *ProxyFSRepository) read() { file, err := os.ReadFile(p) if errors.Is(err, os.ErrNotExist) { - log.Default.Info("redirects.json doesn't exists or could not be found") + log.Info("redirects.json doesn't exists or could not be found") } else if err != nil { - log.Default.Error(err) + log.Error(err) return } err = json.Unmarshal(file, &a.redirects) if err != nil { - log.Default.Error(err) + log.Error(err) return } } diff --git a/adapter/runner_docker.go b/adapter/runner_docker.go index 4030e339..b80a5555 100644 --- a/adapter/runner_docker.go +++ b/adapter/runner_docker.go @@ -32,7 +32,7 @@ type dockerMessage struct { func NewRunnerDockerAdapter() RunnerDockerAdapter { cli, err := client.NewClientWithOpts(client.FromEnv, client.WithAPIVersionNegotiation()) if err != nil { - log.Default.Warn("couldn't connect with the Docker cli.", + log.Warn("couldn't connect with the Docker cli.", vlog.String("error", err.Error()), ) @@ -80,7 +80,7 @@ func (a RunnerDockerAdapter) Start(instance *types.Instance, onLog func(msg stri if errors.Is(err, ErrContainerNotFound) { containerName := instance.DockerContainerName() - log.Default.Info("container doesn't exists, create it.", + log.Info("container doesn't exists, create it.", vlog.String("container_name", containerName), ) @@ -228,12 +228,12 @@ func (a RunnerDockerAdapter) CheckForUpdates(instance *types.Instance) error { } if latestImageID == currentImageID { - log.Default.Info("already up-to-date", + log.Info("already up-to-date", vlog.String("uuid", instance.UUID.String()), ) instance.Update = nil } else { - log.Default.Info("a new update is available", + log.Info("a new update is available", vlog.String("uuid", instance.UUID.String()), ) instance.Update = &types.InstanceUpdate{ @@ -344,7 +344,7 @@ func (a RunnerDockerAdapter) buildImageFromDockerfile(instancePath string, image msg := dockerMessage{} err := json.Unmarshal(scanner.Bytes(), &msg) if err != nil { - log.Default.Warn("Failed to parse message", + log.Warn("Failed to parse message", vlog.String("message", scanner.Text()), ) } else { @@ -354,7 +354,7 @@ func (a RunnerDockerAdapter) buildImageFromDockerfile(instancePath string, image } } - log.Default.Info("Docker build: success.") + log.Info("Docker build: success.") return nil } @@ -388,7 +388,7 @@ func (a RunnerDockerAdapter) createContainer(options createContainerOptions) (st res, err := a.cli.ContainerCreate(context.Background(), &config, &hostConfig, nil, nil, options.containerName) for _, warn := range res.Warnings { - log.Default.Warn("warning while creating container", + log.Warn("warning while creating container", vlog.String("warning", warn), ) } @@ -402,12 +402,12 @@ func (a RunnerDockerAdapter) watchForStatusChange(containerID string, instance * select { case err := <-errChan: if err != nil { - log.Default.Error(err, + log.Error(err, vlog.String("uuid", instance.UUID.String()), ) } case status := <-resChan: - log.Default.Info("container exited", + log.Info("container exited", vlog.String("uuid", instance.UUID.String()), vlog.Int64("status", status.StatusCode), ) @@ -426,7 +426,7 @@ func (a RunnerDockerAdapter) watchForLogs(containerID string, instance *types.In Tail: "0", }) if err != nil { - log.Default.Error(err, + log.Error(err, vlog.String("uuid", instance.UUID.String()), ) } @@ -436,7 +436,7 @@ func (a RunnerDockerAdapter) watchForLogs(containerID string, instance *types.In onLog(scanner.Text()) } _ = logs.Close() - log.Default.Info("logs pipe closed", + log.Info("logs pipe closed", vlog.String("uuid", instance.UUID.String()), ) }() diff --git a/adapter/runner_fs.go b/adapter/runner_fs.go index 62aa7a4c..89bbf70c 100644 --- a/adapter/runner_fs.go +++ b/adapter/runner_fs.go @@ -31,7 +31,7 @@ func (a RunnerFSAdapter) Delete(instance *types.Instance) error { func (a RunnerFSAdapter) Start(instance *types.Instance, onLog func(msg string), onErr func(msg string), setStatus func(status string)) error { if a.commands[instance.UUID] != nil { - log.Default.Error(errors.New("runner already started"), + log.Error(errors.New("runner already started"), vlog.String("name", instance.Name), ) } @@ -102,7 +102,7 @@ func (a RunnerFSAdapter) Start(instance *types.Instance, onLog func(msg string), go func() { err := cmd.Wait() if err != nil { - log.Default.Error(err, + log.Error(err, vlog.String("name", instance.Service.Name), ) } diff --git a/adapter/service_fs.go b/adapter/service_fs.go index 24be6b74..12103266 100644 --- a/adapter/service_fs.go +++ b/adapter/service_fs.go @@ -34,7 +34,7 @@ func NewServiceFSAdapter(params *ServiceFSAdapterParams) types.ServiceAdapterPor } err := adapter.Reload() if err != nil { - log.Default.Error(fmt.Errorf("failed to reload services: %v", err)) + log.Error(fmt.Errorf("failed to reload services: %v", err)) } return adapter } diff --git a/adapter/settings_fs.go b/adapter/settings_fs.go index 65c6adb0..f34b2762 100644 --- a/adapter/settings_fs.go +++ b/adapter/settings_fs.go @@ -31,7 +31,7 @@ func NewSettingsFSAdapter(params *SettingsFSAdapterParams) types.SettingsAdapter err := os.MkdirAll(params.settingsPath, os.ModePerm) if err != nil && !os.IsExist(err) { - log.Default.Error(err, + log.Error(err, vlog.String("message", "failed to create directory"), vlog.String("path", params.settingsPath), ) @@ -44,7 +44,7 @@ func NewSettingsFSAdapter(params *SettingsFSAdapterParams) types.SettingsAdapter err = adapter.read() if err != nil { - log.Default.Error(err) + log.Error(err) } return adapter @@ -74,7 +74,7 @@ func (a *SettingsFSAdapter) read() error { file, err := os.ReadFile(p) if errors.Is(err, os.ErrNotExist) { - log.Default.Info("settings.json doesn't exists or could not be found") + log.Info("settings.json doesn't exists or could not be found") return nil } else if err != nil { return err diff --git a/init.go b/init.go index 872f7e73..8dd91403 100644 --- a/init.go +++ b/init.go @@ -23,21 +23,21 @@ var ( ) func main() { - defer log.Default.Close() + defer log.Defaul.Close() - log.Default.Info("Vertex starting...") + log.Info("Vertex starting...") parseArgs() err := setupDependencies() if err != nil { - log.Default.Error(fmt.Errorf("failed to setup dependencies: %v", err)) + log.Error(fmt.Errorf("failed to setup dependencies: %v", err)) return } err = config.Current.Apply() if err != nil { - log.Default.Error(fmt.Errorf("failed to apply the current configuration: %v", err)) + log.Error(fmt.Errorf("failed to apply the current configuration: %v", err)) return } @@ -54,7 +54,7 @@ func main() { // Logs url := fmt.Sprintf("http://%s", config.Current.Host) fmt.Printf("\n-- Vertex Client :: %s\n\n", url) - log.Default.Info("Vertex started", + log.Info("Vertex started", vlog.String("url", url), ) @@ -98,7 +98,7 @@ func setupDependencies() error { for _, dep := range dependencies { err := setupDependency(dep) if err != nil { - log.Default.Error(err) + log.Error(err) os.Exit(1) } } diff --git a/pkg/ginutils/logger.go b/pkg/ginutils/logger.go index 816ab3a7..416f411c 100644 --- a/pkg/ginutils/logger.go +++ b/pkg/ginutils/logger.go @@ -9,7 +9,7 @@ import ( func Logger(router string) gin.HandlerFunc { return gin.LoggerWithFormatter(func(params gin.LogFormatterParams) string { if params.ErrorMessage != "" { - log.Default.Request("request", + log.Request("request", vlog.String("router", router), vlog.String("method", params.Method), vlog.Int("status", params.StatusCode), @@ -20,7 +20,7 @@ func Logger(router string) gin.HandlerFunc { vlog.String("error", params.ErrorMessage), ) } else { - log.Default.Request("request", + log.Request("request", vlog.String("router", router), vlog.String("method", params.Method), vlog.Int("status", params.StatusCode), diff --git a/pkg/log/log.go b/pkg/log/log.go index 0a042262..f58fd5ab 100644 --- a/pkg/log/log.go +++ b/pkg/log/log.go @@ -2,8 +2,28 @@ package log import "github.com/vertex-center/vlog" -var Default = *vlog.New( +var Defaul = *vlog.New( vlog.WithOutputStd(), vlog.WithOutputFile("live/logs", vlog.LogFormatText), vlog.WithOutputFile("live/logs", vlog.LogFormatJson), ) + +func Debug(msg string, fields ...vlog.KeyValue) { + Defaul.Debug(msg, fields...) +} + +func Info(msg string, fields ...vlog.KeyValue) { + Defaul.Info(msg, fields...) +} + +func Warn(msg string, fields ...vlog.KeyValue) { + Defaul.Warn(msg, fields...) +} + +func Error(err error, fields ...vlog.KeyValue) { + Defaul.Error(err, fields...) +} + +func Request(msg string, fields ...vlog.KeyValue) { + Defaul.Request(msg, fields...) +} diff --git a/pkg/storage/storage.go b/pkg/storage/storage.go index 047e9c8b..3c3a1d2b 100644 --- a/pkg/storage/storage.go +++ b/pkg/storage/storage.go @@ -25,7 +25,7 @@ var ( ) func CloneOrPullRepository(url string, dest string) error { - log.Default.Info("downloading repository", + log.Info("downloading repository", vlog.String("url", url), ) @@ -57,7 +57,7 @@ func CloneOrPullRepository(url string, dest string) error { } func DownloadLatestGithubRelease(owner string, repo string, dest string) error { - log.Default.Info("downloading repository", + log.Info("downloading repository", vlog.String("owner", owner), vlog.String("repo", repo), ) @@ -73,7 +73,7 @@ func DownloadLatestGithubRelease(owner string, repo string, dest string) error { } func DownloadGithubRelease(release *github.RepositoryRelease, dest string) error { - log.Default.Info("downloading release", + log.Info("downloading release", vlog.String("release", *release.Name), ) diff --git a/pkg/vdownloader/download.go b/pkg/vdownloader/download.go index 45cbd623..e6351bb4 100644 --- a/pkg/vdownloader/download.go +++ b/pkg/vdownloader/download.go @@ -13,7 +13,7 @@ import ( // Download downloads a file from a URL. It creates the // directory if it doesn't exist. func Download(url string, dir string, filename string) error { - log.Default.Info("downloading", + log.Info("downloading", vlog.String("url", url), ) diff --git a/router/instance.go b/router/instance.go index 9995aed6..717b0f77 100644 --- a/router/instance.go +++ b/router/instance.go @@ -207,7 +207,7 @@ func handleInstanceEvents(c *gin.Context) { }) if err != nil { - log.Default.Error(err) + log.Error(err) return false } first = false @@ -218,7 +218,7 @@ func handleInstanceEvents(c *gin.Context) { case e := <-eventsChan: err := sse.Encode(w, e) if err != nil { - log.Default.Error(err) + log.Error(err) } return true case <-done: @@ -240,7 +240,7 @@ func handleGetDependencies(c *gin.Context) { for name := range *i.Methods.Script.Dependencies { dep, err := packageService.GetByID(name) if err != nil { - log.Default.Error(err) + log.Error(err) continue } deps[name] = dep diff --git a/router/instances.go b/router/instances.go index 5dd8dfcf..75e1c83d 100644 --- a/router/instances.go +++ b/router/instances.go @@ -58,7 +58,7 @@ func handleInstancesEvents(c *gin.Context) { }) if err != nil { - log.Default.Error(err) + log.Error(err) return false } first = false @@ -69,7 +69,7 @@ func handleInstancesEvents(c *gin.Context) { case e := <-eventsChan: err := sse.Encode(w, e) if err != nil { - log.Default.Error(err) + log.Error(err) } return true case <-done: diff --git a/router/packages.go b/router/packages.go index a65f37cf..bc7ce594 100644 --- a/router/packages.go +++ b/router/packages.go @@ -32,7 +32,7 @@ func handleInstallPackages(c *gin.Context) { for _, d := range body.Packages { pkg, err := packageService.GetByID(d.Name) if err != nil { - log.Default.Warn("dependency not found", + log.Warn("dependency not found", vlog.String("name", d.Name), vlog.String("package_manager", d.PackageManager), ) @@ -40,14 +40,14 @@ func handleInstallPackages(c *gin.Context) { continue } - log.Default.Info("installing package", + log.Info("installing package", vlog.String("name", d.Name), vlog.String("package_manager", d.PackageManager), ) cmd, err := packageService.InstallationCommand(&pkg, d.PackageManager) if err != nil { - log.Default.Error(err) + log.Error(err) continue } @@ -59,12 +59,12 @@ func handleInstallPackages(c *gin.Context) { } else { err = packageService.Install(cmd) if err != nil { - log.Default.Error(err) + log.Error(err) continue } } - log.Default.Info("package installed successfully", + log.Info("package installed successfully", vlog.String("name", d.Name), vlog.String("package_manager", d.PackageManager), ) diff --git a/router/router.go b/router/router.go index 83fb3179..e5ca7333 100644 --- a/router/router.go +++ b/router/router.go @@ -71,7 +71,7 @@ func (r *Router) Start(addr string) { go func() { err := proxyService.Start() if err != nil { - log.Default.Error(err) + log.Error(err) return } @@ -87,14 +87,14 @@ func (r *Router) Start(addr string) { err := notificationsService.StartWebhook() if err != nil { - log.Default.Error(err) + log.Error(err) } err = r.server.ListenAndServe() if errors.Is(err, http.ErrServerClosed) { - log.Default.Info("Vertex closed") + log.Info("Vertex closed") } else if err != nil { - log.Default.Error(err) + log.Error(err) } } @@ -105,7 +105,7 @@ func (r *Router) Stop() { err := r.server.Shutdown(context.Background()) if err != nil { - log.Default.Error(err) + log.Error(err) return } @@ -123,7 +123,7 @@ func (r *Router) handleSignals() { signal.Notify(c, os.Interrupt) go func() { <-c - log.Default.Info("shutdown signal sent") + log.Info("shutdown signal sent") r.Stop() os.Exit(0) }() diff --git a/services/instance.go b/services/instance.go index cfda8585..e24dd504 100644 --- a/services/instance.go +++ b/services/instance.go @@ -103,7 +103,7 @@ func (s *InstanceService) Start(uuid uuid.UUID) error { Message: "Starting instance...", }) - log.Default.Info("starting instance", + log.Info("starting instance", vlog.String("uuid", uuid.String()), ) @@ -151,7 +151,7 @@ func (s *InstanceService) Start(uuid uuid.UUID) error { Message: "Instance started.", }) - log.Default.Info("instance started", + log.Info("instance started", vlog.String("uuid", uuid.String()), ) } @@ -177,17 +177,17 @@ func (s *InstanceService) StartAll() { return } - log.Default.Info("trying to ping Google...") + log.Info("trying to ping Google...") // Wait for internet connection if !wait.New( wait.WithWait(time.Second), wait.WithBreak(500*time.Millisecond), ).Do([]string{"google.com:80"}) { - log.Default.Error(errors.New("internet connection: Failed to ping google.com")) + log.Error(errors.New("internet connection: Failed to ping google.com")) return } else { - log.Default.Info("internet connection: OK") + log.Info("internet connection: OK") } // Start them @@ -195,7 +195,7 @@ func (s *InstanceService) StartAll() { go func(id uuid.UUID) { err := s.Start(id) if err != nil { - log.Default.Error(err) + log.Error(err) } }(id) } @@ -213,7 +213,7 @@ func (s *InstanceService) Stop(uuid uuid.UUID) error { Message: "Stopping instance...", }) - log.Default.Info("stopping instance", + log.Info("stopping instance", vlog.String("uuid", uuid.String()), ) @@ -241,7 +241,7 @@ func (s *InstanceService) Stop(uuid uuid.UUID) error { Message: "Instance stopped.", }) - log.Default.Info("instance stopped", + log.Info("instance stopped", vlog.String("uuid", uuid.String()), ) @@ -260,7 +260,7 @@ func (s *InstanceService) StopAll() { } err := s.Stop(i.UUID) if err != nil { - log.Default.Error(err) + log.Error(err) } } } @@ -464,7 +464,7 @@ func (s *InstanceService) reload() { s.instanceAdapter.Reload(func(uuid uuid.UUID) { err := s.load(uuid) if err != nil { - log.Default.Error(err) + log.Error(err) return } }) diff --git a/services/notifications.go b/services/notifications.go index 30c829b3..b84af6b4 100644 --- a/services/notifications.go +++ b/services/notifications.go @@ -71,7 +71,7 @@ func (s *NotificationsService) sendStatus(instanceUUID uuid.UUID, status string) instance, err := s.instanceAdapter.Get(instanceUUID) if err != nil { - log.Default.Error(err) + log.Error(err) return } diff --git a/services/proxy.go b/services/proxy.go index aca8b530..59b5d6e6 100644 --- a/services/proxy.go +++ b/services/proxy.go @@ -53,7 +53,7 @@ func (s *ProxyService) Start() error { go func() { err := s.server.ListenAndServe() if err != nil && !errors.Is(err, http.ErrServerClosed) { - log.Default.Error(err) + log.Error(err) return } }() @@ -96,7 +96,7 @@ func (s *ProxyService) handleProxy(c *gin.Context) { } if redirect == nil { - log.Default.Warn("this host is not registered in the reverse proxy", + log.Warn("this host is not registered in the reverse proxy", vlog.String("host", host), ) return @@ -104,14 +104,14 @@ func (s *ProxyService) handleProxy(c *gin.Context) { target, err := url.Parse(redirect.Target) if err != nil { - log.Default.Error(err) + log.Error(err) return } proxy := httputil.NewSingleHostReverseProxy(target) proxy.ErrorHandler = func(w http.ResponseWriter, request *http.Request, err error) { if err != nil && !errors.Is(err, context.Canceled) { - log.Default.Error(err) + log.Error(err) } } proxy.Director = func(request *http.Request) { diff --git a/services/update.go b/services/update.go index 7c3cf539..cf77c18e 100644 --- a/services/update.go +++ b/services/update.go @@ -55,12 +55,12 @@ func (s *UpdateDependenciesService) GetCachedUpdates() types.Updates { } func (s *UpdateDependenciesService) CheckForUpdates() (types.Updates, error) { - log.Default.Info("fetching all updates...") + log.Info("fetching all updates...") s.updates.Items = []types.Update{} for _, dependency := range s.dependencies { - log.Default.Info("fetching dependency", + log.Info("fetching dependency", vlog.String("id", dependency.GetID()), ) @@ -69,12 +69,12 @@ func (s *UpdateDependenciesService) CheckForUpdates() (types.Updates, error) { return types.Updates{}, err } if update != nil { - log.Default.Info("dependency needs update", + log.Info("dependency needs update", vlog.String("id", dependency.GetID()), ) s.updates.Items = append(s.updates.Items, *update) } else { - log.Default.Info("dependency already up-to-date", + log.Info("dependency already up-to-date", vlog.String("id", dependency.GetID()), ) } @@ -111,7 +111,7 @@ type vertexDependency struct { func (d *vertexDependency) CheckForUpdate() (*types.Update, error) { if d.currentVersion == "dev" { - log.Default.Info("skipping vertex update in 'dev' version") + log.Info("skipping vertex update in 'dev' version") return nil, nil } @@ -146,7 +146,7 @@ func (d *vertexDependency) CheckForUpdate() (*types.Update, error) { NeedsRestart: true, } - log.Default.Info("a new release for Vertex is available", + log.Info("a new release for Vertex is available", vlog.String("current", d.currentVersion), vlog.String("release", latestVersion), ) @@ -180,7 +180,7 @@ func (d *vertexDependency) InstallUpdate() error { d.release = nil d.update = nil - log.Default.Warn("a new Vertex update has been installed. please restart Vertex to apply changes.") + log.Warn("a new Vertex update has been installed. please restart Vertex to apply changes.") return nil } @@ -230,7 +230,7 @@ func (d *VertexClientDependency) CheckForUpdate() (*types.Update, error) { } func (d *VertexClientDependency) InstallUpdate() error { - log.Default.Info("downloading vertex-webui client...") + log.Info("downloading vertex-webui client...") for _, asset := range d.release.Assets { if strings.Contains(*asset.Name, "vertex-webui") {