Plugins: Refactor plugin download/installation (#43046)
* installer -> repo * add semver format checking * add plugin callbacks in test * remove newline * post install only scans new directories * remove unused stuff * everything in own package * add missing cli params * make grafana version part of the API * resolve conflicts * tidy up logger * fix cli and tidy log statements * rename log package * update struct name * fix linter issue * fs -> filestore * reorder imports * alias import * fix test * fix test * inline var * revert jsonc file * make repo dep of manager * actually inject the thing * accept all args for compatability checks * accept compat from store * pass os + arch vals * don't inject fs * tidy up * tidy up * merge with main and tidy fs storage * fix test * fix packages * fix comment + field name * update fs naming * fixed wire * remove unused func * fix mocks * fix storage test * renaming * fix log line * fix test * re-order field * tidying * add test for update with same version * fix wire for CLI * remove use of ioutil * don't pass field * small tidy * ignore code scanning warn * fix testdata link * update lgtm code
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
package logger
|
||||
|
||||
// Logger is used primarily to facilitate logging/user feedback for both
|
||||
// the grafana-cli and the grafana backend when managing plugin installs
|
||||
type Logger interface {
|
||||
Successf(format string, args ...interface{})
|
||||
Failuref(format string, args ...interface{})
|
||||
|
||||
Info(args ...interface{})
|
||||
Infof(format string, args ...interface{})
|
||||
Debug(args ...interface{})
|
||||
Debugf(format string, args ...interface{})
|
||||
Warn(args ...interface{})
|
||||
Warnf(format string, args ...interface{})
|
||||
Error(args ...interface{})
|
||||
Errorf(format string, args ...interface{})
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package logger
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
)
|
||||
|
||||
type InfraLogWrapper struct {
|
||||
log log.Logger
|
||||
}
|
||||
|
||||
func NewLogger(name string) (l *InfraLogWrapper) {
|
||||
return &InfraLogWrapper{
|
||||
log: log.New(name),
|
||||
}
|
||||
}
|
||||
|
||||
func (l *InfraLogWrapper) Successf(format string, args ...interface{}) {
|
||||
l.log.Info(fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
func (l *InfraLogWrapper) Failuref(format string, args ...interface{}) {
|
||||
l.log.Error(fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
func (l *InfraLogWrapper) Info(args ...interface{}) {
|
||||
l.log.Info(fmt.Sprint(args...))
|
||||
}
|
||||
|
||||
func (l *InfraLogWrapper) Infof(format string, args ...interface{}) {
|
||||
l.log.Info(fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
func (l *InfraLogWrapper) Debug(args ...interface{}) {
|
||||
l.log.Debug(fmt.Sprint(args...))
|
||||
}
|
||||
|
||||
func (l *InfraLogWrapper) Debugf(format string, args ...interface{}) {
|
||||
l.log.Debug(fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
func (l *InfraLogWrapper) Warn(args ...interface{}) {
|
||||
l.log.Warn(fmt.Sprint(args...))
|
||||
}
|
||||
|
||||
func (l *InfraLogWrapper) Warnf(format string, args ...interface{}) {
|
||||
l.log.Warn(fmt.Sprintf(format, args...))
|
||||
}
|
||||
|
||||
func (l *InfraLogWrapper) Error(args ...interface{}) {
|
||||
l.log.Error(fmt.Sprint(args...))
|
||||
}
|
||||
|
||||
func (l *InfraLogWrapper) Errorf(format string, args ...interface{}) {
|
||||
l.log.Error(fmt.Sprintf(format, args...))
|
||||
}
|
||||
Reference in New Issue
Block a user