Plugins: Introduce plugin package specific logger (#62204)

* refactor

* implement with infra log for now

* undo moving

* update package name

* update name

* fix tests

* update pretty signature

* update naming

* simplify

* fix typo

* delete comment

* fix import

* retrigger
This commit is contained in:
Will Browne
2023-02-28 16:10:27 +01:00
committed by GitHub
parent ab8de1a0e3
commit ec82719372
38 changed files with 259 additions and 140 deletions
+3 -3
View File
@@ -15,7 +15,7 @@ import (
"os"
"time"
"github.com/grafana/grafana/pkg/plugins/logger"
"github.com/grafana/grafana/pkg/plugins/log"
)
type Client struct {
@@ -23,10 +23,10 @@ type Client struct {
httpClientNoTimeout http.Client
retryCount int
log logger.Logger
log log.PrettyLogger
}
func newClient(skipTLSVerify bool, logger logger.Logger) *Client {
func newClient(skipTLSVerify bool, logger log.PrettyLogger) *Client {
return &Client{
httpClient: makeHttpClient(skipTLSVerify, 10*time.Second),
httpClientNoTimeout: makeHttpClient(skipTLSVerify, 0),
+4 -4
View File
@@ -8,22 +8,22 @@ import (
"path"
"strings"
"github.com/grafana/grafana/pkg/plugins/logger"
"github.com/grafana/grafana/pkg/plugins/log"
)
type Manager struct {
client *Client
baseURL string
log logger.Logger
log log.PrettyLogger
}
func ProvideService() *Manager {
defaultBaseURL := "https://grafana.com/api/plugins"
return New(false, defaultBaseURL, logger.NewLogger("plugin.repository"))
return New(false, defaultBaseURL, log.NewPrettyLogger("plugin.repository"))
}
func New(skipTLSVerify bool, baseURL string, logger logger.Logger) *Manager {
func New(skipTLSVerify bool, baseURL string, logger log.PrettyLogger) *Manager {
return &Manager{
client: newClient(skipTLSVerify, logger),
baseURL: baseURL,