feat: first pass at improving logging (#1956)

Signed-off-by: Chris Jowett <421501+cryptk@users.noreply.github.com>
This commit is contained in:
cryptk 2024-04-04 02:24:22 -05:00 committed by GitHub
parent 3851b51d98
commit b85dad0286
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 53 additions and 43 deletions

10
main.go
View file

@ -45,7 +45,7 @@ func main() {
path, err := os.Getwd()
if err != nil {
log.Error().Msgf("error: %s", err.Error())
log.Error().Err(err).Msg("failed to get current directory")
os.Exit(1)
}
@ -340,7 +340,7 @@ For a list of compatible model, check out: https://localai.io/model-compatibilit
appHTTP, err := http.App(cl, ml, options)
if err != nil {
log.Error().Msg("Error during HTTP App constructor")
log.Error().Err(err).Msg("error during HTTP App construction")
return err
}
@ -357,7 +357,7 @@ For a list of compatible model, check out: https://localai.io/model-compatibilit
Action: func(ctx *cli.Context) error {
var galleries []gallery.Gallery
if err := json.Unmarshal([]byte(ctx.String("galleries")), &galleries); err != nil {
log.Error().Msgf("unable to load galleries: %s", err.Error())
log.Error().Err(err).Msg("unable to load galleries")
}
models, err := gallery.AvailableGalleryModels(galleries, ctx.String("models-path"))
@ -382,7 +382,7 @@ For a list of compatible model, check out: https://localai.io/model-compatibilit
var galleries []gallery.Gallery
if err := json.Unmarshal([]byte(ctx.String("galleries")), &galleries); err != nil {
log.Error().Msgf("unable to load galleries: %s", err.Error())
log.Error().Err(err).Msg("unable to load galleries")
}
progressBar := progressbar.NewOptions(
@ -547,7 +547,7 @@ For a list of compatible model, check out: https://localai.io/model-compatibilit
err = app.Run(os.Args)
if err != nil {
log.Error().Msgf("error: %s", err.Error())
log.Error().Err(err).Msg("application runtime error")
os.Exit(1)
}
}