mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Scraper log improvements (#1741)
* Fix logs from scraper and plugins not being shown in UI Using `logger.` in the logger package to write logs is "incorrect". This as the package contains a variable named `logger` which contains the logrus instance. So instead of the log line being handled by the custom log implementation / wrapper which makes sure the lines are shown in the UI as well, it's written to logrus directly meaning the wrapper is skipped. This "issue" is obviously triggered because in any other place `logger.X` can be used and it will used the custom logger package / wrapper which works fine. * Add plugin / scraper name to logging output Indicate which plugin / scraper wrote a log message by including its name to the `[Scrape]` prefix. * Add missing addLogItem call
This commit is contained in:
@@ -1,22 +1,23 @@
|
||||
package plugin
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"github.com/stashapp/stash/pkg/logger"
|
||||
)
|
||||
|
||||
func (t *pluginTask) handlePluginStderr(pluginOutputReader io.ReadCloser) {
|
||||
func (t *pluginTask) handlePluginStderr(name string, pluginOutputReader io.ReadCloser) {
|
||||
logLevel := logger.PluginLogLevelFromName(t.plugin.PluginErrLogLevel)
|
||||
if logLevel == nil {
|
||||
// default log level to error
|
||||
logLevel = &logger.ErrorLevel
|
||||
}
|
||||
|
||||
const pluginPrefix = "[Plugin] "
|
||||
const pluginPrefix = "[Plugin / %s] "
|
||||
|
||||
lgr := logger.PluginLogger{
|
||||
Prefix: pluginPrefix,
|
||||
Prefix: fmt.Sprintf(pluginPrefix, name),
|
||||
DefaultLogLevel: logLevel,
|
||||
ProgressChan: t.progress,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user