2020-08-08 02:05:35 +00:00
|
|
|
package plugin
|
|
|
|
|
|
|
|
import (
|
2021-09-19 00:06:34 +00:00
|
|
|
"fmt"
|
2020-08-08 02:05:35 +00:00
|
|
|
"io"
|
|
|
|
|
|
|
|
"github.com/stashapp/stash/pkg/logger"
|
|
|
|
)
|
|
|
|
|
2021-09-19 00:06:34 +00:00
|
|
|
func (t *pluginTask) handlePluginStderr(name string, pluginOutputReader io.ReadCloser) {
|
2021-09-16 23:09:44 +00:00
|
|
|
logLevel := logger.PluginLogLevelFromName(t.plugin.PluginErrLogLevel)
|
2020-08-08 02:05:35 +00:00
|
|
|
if logLevel == nil {
|
|
|
|
// default log level to error
|
2021-09-16 23:09:44 +00:00
|
|
|
logLevel = &logger.ErrorLevel
|
|
|
|
}
|
|
|
|
|
2021-09-19 00:06:34 +00:00
|
|
|
const pluginPrefix = "[Plugin / %s] "
|
2021-09-16 23:09:44 +00:00
|
|
|
|
|
|
|
lgr := logger.PluginLogger{
|
2021-09-19 00:06:34 +00:00
|
|
|
Prefix: fmt.Sprintf(pluginPrefix, name),
|
2021-09-16 23:09:44 +00:00
|
|
|
DefaultLogLevel: logLevel,
|
|
|
|
ProgressChan: t.progress,
|
2020-08-08 02:05:35 +00:00
|
|
|
}
|
|
|
|
|
2021-09-16 23:09:44 +00:00
|
|
|
lgr.HandlePluginStdErr(pluginOutputReader)
|
2020-08-08 02:05:35 +00:00
|
|
|
}
|