diff --git a/internal/config/config.go b/internal/config/config.go index df9354fc2..426702c37 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -393,10 +393,13 @@ func (c *Config) AdminPassword() string { return c.options.AdminPassword } -// LogLevel returns the logrus log level. +// LogLevel returns the Logrus log level. func (c *Config) LogLevel() logrus.Level { - if c.Debug() { - c.options.LogLevel = "debug" + // Normalize string. + c.options.LogLevel = strings.ToLower(strings.TrimSpace(c.options.LogLevel)) + + if c.Debug() && c.options.LogLevel != logrus.TraceLevel.String() { + c.options.LogLevel = logrus.DebugLevel.String() } if logLevel, err := logrus.ParseLevel(c.options.LogLevel); err == nil { diff --git a/internal/photoprism/convert.go b/internal/photoprism/convert.go index df0465e5e..6957f8a26 100644 --- a/internal/photoprism/convert.go +++ b/internal/photoprism/convert.go @@ -184,7 +184,7 @@ func (c *Convert) ToJson(f *MediaFile) (jsonName string, err error) { // JpegConvertCommand returns the command for converting files to JPEG, depending on the format. func (c *Convert) JpegConvertCommand(f *MediaFile, jpegName string, xmpName string) (result *exec.Cmd, useMutex bool, err error) { if f == nil { - return result, useMutex, fmt.Errorf("convert: file is nil - you might have found a bug") + return result, useMutex, fmt.Errorf("file is nil - you might have found a bug") } size := strconv.Itoa(c.conf.JpegSize()) @@ -220,14 +220,19 @@ func (c *Convert) JpegConvertCommand(f *MediaFile, jpegName string, xmpName stri result = exec.Command(c.conf.RawtherapeeBin(), args...) } else { - return nil, useMutex, fmt.Errorf("convert: no converter found for %s", txt.Quote(f.BaseName())) + return nil, useMutex, fmt.Errorf("no suitable converter found") } } else if f.IsVideo() && c.conf.FFmpegEnabled() { result = exec.Command(c.conf.FFmpegBin(), "-y", "-i", f.FileName(), "-ss", "00:00:00.001", "-vframes", "1", jpegName) } else if f.IsHEIF() && c.conf.HeifConvertEnabled() { result = exec.Command(c.conf.HeifConvertBin(), f.FileName(), jpegName) } else { - return nil, useMutex, fmt.Errorf("convert: file type %s not supported in %s", f.FileType(), txt.Quote(f.BaseName())) + return nil, useMutex, fmt.Errorf("file type %s not supported", f.FileType()) + } + + // Log convert command in trace mode only as it exposes server internals. + if result != nil { + log.Tracef("convert: %s", result.String()) } return result, useMutex, nil diff --git a/internal/photoprism/convert_worker.go b/internal/photoprism/convert_worker.go index d31763a90..e637f8a64 100644 --- a/internal/photoprism/convert_worker.go +++ b/internal/photoprism/convert_worker.go @@ -14,7 +14,7 @@ type ConvertJob struct { func ConvertWorker(jobs <-chan ConvertJob) { logError := func(err error, job ConvertJob) { fileName := job.file.RelName(job.convert.conf.OriginalsPath()) - log.Errorf("%s in %s", strings.TrimSpace(err.Error()), txt.Quote(fileName)) + log.Errorf("convert: %s for %s", strings.TrimSpace(err.Error()), txt.Quote(fileName)) } for job := range jobs {