remove crit and trace (#40320)

This commit is contained in:
ying-jeanne
2021-10-26 17:36:24 +02:00
committed by GitHub
parent 728a59f013
commit 681218275e
20 changed files with 58 additions and 42 deletions
+1 -1
View File
@@ -51,7 +51,7 @@ func (hs *HTTPServer) initAppPluginRoutes(r *web.Mux) {
for _, method := range strings.Split(route.Method, ",") {
r.Handle(strings.TrimSpace(method), url, handlers)
}
log.Debugf("Plugins: Adding proxy route %s", url)
log.Debug("Plugins: Adding proxy route", "url", url)
}
}
}
+5 -5
View File
@@ -95,7 +95,7 @@ func (a *CacheServer) Handler(ctx *models.ReqContext) {
if avatar.Expired() {
// The cache item is either expired or newly created, update it from the server
if err := avatar.Update(); err != nil {
log.Tracef("avatar update error: %v", err)
log.Debug("avatar update", "err", err)
avatar = a.notFound
}
}
@@ -104,7 +104,7 @@ func (a *CacheServer) Handler(ctx *models.ReqContext) {
avatar = a.notFound
} else if !exists {
if err := a.cache.Add(hash, avatar, gocache.DefaultExpiration); err != nil {
log.Tracef("Error adding avatar to cache: %s", err)
log.Debug("add avatar to cache", "err", err)
}
}
@@ -117,7 +117,7 @@ func (a *CacheServer) Handler(ctx *models.ReqContext) {
ctx.Resp.Header().Set("Cache-Control", "private, max-age=3600")
if err := avatar.Encode(ctx.Resp); err != nil {
log.Warnf("avatar encode error: %v", err)
log.Warn("avatar encode error:", "err", err)
ctx.Resp.WriteHeader(500)
}
}
@@ -142,7 +142,7 @@ func newNotFound(cfg *setting.Cfg) *Avatar {
// variable.
// nolint:gosec
if data, err := ioutil.ReadFile(path); err != nil {
log.Errorf(3, "Failed to read user_profile.png, %v", path)
log.Error("Failed to read user_profile.png", "path", path)
} else {
avatar.data = bytes.NewBuffer(data)
}
@@ -215,7 +215,7 @@ var client = &http.Client{
func (a *thunderTask) fetch() error {
a.Avatar.timestamp = time.Now()
log.Debugf("avatar.fetch(fetch new avatar): %s", a.Url)
log.Debug("avatar.fetch(fetch new avatar)", "url", a.Url)
req, err := http.NewRequest("GET", a.Url, nil)
if err != nil {
return err
+1 -1
View File
@@ -65,7 +65,7 @@ func GetGravatarUrl(text string) string {
hasher := md5.New()
if _, err := hasher.Write([]byte(strings.ToLower(text))); err != nil {
log.Warnf("Failed to hash text: %s", err)
log.Warn("Failed to hash text", "err", err)
}
return fmt.Sprintf(setting.AppSubUrl+"/avatar/%x", hasher.Sum(nil))
}
+1 -1
View File
@@ -63,7 +63,7 @@ func (hs *HTTPServer) getFSDataSources(c *models.ReqContext, enabledPlugins *plu
meta, exists := enabledPlugins.DataSources[ds.Type]
if !exists {
log.Errorf(3, "Could not find plugin definition for data source: %v", ds.Type)
log.Error("Could not find plugin definition for data source", "datasource_type", ds.Type)
continue
}
dsMap["meta"] = meta
+4 -4
View File
@@ -130,7 +130,7 @@ func (hs *HTTPServer) LoginView(c *models.ReqContext) {
if err := hs.ValidateRedirectTo(redirectTo); err != nil {
// the user is already logged so instead of rendering the login page with error
// it should be redirected to the home page.
log.Debugf("Ignored invalid redirect_to cookie value: %v", redirectTo)
log.Debug("Ignored invalid redirect_to cookie value", "redirect_to", redirectTo)
redirectTo = hs.Cfg.AppSubURL + "/"
}
cookies.DeleteCookie(c.Resp, "redirect_to", hs.CookieOptionsFromCfg)
@@ -151,12 +151,12 @@ func (hs *HTTPServer) tryOAuthAutoLogin(c *models.ReqContext) bool {
}
oauthInfos := hs.SocialService.GetOAuthInfoProviders()
if len(oauthInfos) != 1 {
log.Warnf("Skipping OAuth auto login because multiple OAuth providers are configured")
log.Warn("Skipping OAuth auto login because multiple OAuth providers are configured")
return false
}
for key := range oauthInfos {
redirectUrl := hs.Cfg.AppSubURL + "/login/" + key
log.Infof("OAuth auto login enabled. Redirecting to " + redirectUrl)
log.Info("OAuth auto login enabled. Redirecting to " + redirectUrl)
c.Redirect(redirectUrl, 307)
return true
}
@@ -248,7 +248,7 @@ func (hs *HTTPServer) LoginPost(c *models.ReqContext) response.Response {
if err := hs.ValidateRedirectTo(redirectTo); err == nil {
result["redirectUrl"] = redirectTo
} else {
log.Infof("Ignored invalid redirect_to cookie value: %v", redirectTo)
log.Info("Ignored invalid redirect_to cookie value.", "url", redirectTo)
}
cookies.DeleteCookie(c.Resp, "redirect_to", hs.CookieOptionsFromCfg)
}
+1 -1
View File
@@ -256,7 +256,7 @@ func (hs *HTTPServer) OAuthLogin(ctx *models.ReqContext) {
ctx.Redirect(redirectTo)
return
}
log.Debugf("Ignored invalid redirect_to cookie value: %v", redirectTo)
log.Debug("Ignored invalid redirect_to cookie value", "redirect_to", redirectTo)
}
ctx.Redirect(setting.AppSubUrl + "/")