grim/convey

Port from logrus to log/slog
default tip
5 months ago, Elliott Sales de Andrade
c588f9b3f559
Port from logrus to log/slog

This doesn't really take much advantage of structured logging beyond what is already done (`id` and `idColor`), and consequently the log handler does not try to do any handling of anything more than that (i.e., grouping, or arbitrary attributes beyond those defined).

One should maybe have a `Context` available to pass in, but there isn't one, and anyway, the log handler doesn't use it, so I've passed in a `TODO` instead.

Everything else is just normal import/rename changes.

Testing Done:
Ran `go run . run`

Reviewed at https://reviews.imfreedom.org/r/2871/
package docker
import (
"fmt"
"log/slog"
"keep.imfreedom.org/grim/convey/environment"
"keep.imfreedom.org/grim/convey/podman"
"keep.imfreedom.org/grim/convey/runtime"
"keep.imfreedom.org/grim/convey/yaml"
)
type Run struct {
Command string `yaml:"command"`
Detach bool `yaml:"detach"`
Entrypoint string `yaml:"entrypoint"`
Environment yaml.StringOrSlice `yaml:"environment"`
HealthCheck interface{} `yaml:"healthcheck"`
Hostname string `yaml:"hostname"`
Image string `yaml:"image"`
Labels yaml.StringOrSlice `yaml:"labels"`
Script yaml.StringOrSlice `yaml:"script"`
Shell string `yaml:"shell"`
User string `yaml:"user"`
Workdir string `yaml:"workdir"`
Workspace string `yaml:"workspace"`
realRun *podman.Run
}
// New creates a new Run task.
func (r *Run) New() runtime.Task {
return &Run{}
}
// Valid validates the export task.
func (r *Run) Valid() error {
if r.Detach == true {
return errDetachRemoved
}
if r.HealthCheck != nil {
return errHealthCheckRemoved
}
r.realRun = &podman.Run{
Annotations: r.Labels,
Command: r.Command,
Entrypoint: r.Entrypoint,
Environment: r.Environment,
Hostname: r.Hostname,
Image: r.Image,
Script: r.Script,
Shell: r.Shell,
User: r.User,
Workdir: r.Workdir,
Workspace: r.Workspace,
}
return r.realRun.Valid()
}
// Execute runs the task.
func (r *Run) Execute(name string, logger *slog.Logger, env environment.Environment, rt *runtime.Runtime) error {
return r.realRun.Execute(name, logger, env, rt)
}
func (r *Run) Deprecated() error {
return fmt.Errorf("docker/run has been deprecated in favor of podman/run since 0.15.0")
}