stash/pkg/plugin/log.go

27 lines
563 B
Go
Raw Normal View History

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