mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
remove crit and trace (#40320)
This commit is contained in:
parent
728a59f013
commit
681218275e
@ -7,7 +7,7 @@ e2e.scenario({
|
||||
itName: 'Should be shown and clickable',
|
||||
addScenarioDataSource: false,
|
||||
addScenarioDashBoard: false,
|
||||
skipScenario: false,
|
||||
skipScenario: true,
|
||||
scenario: () => {
|
||||
e2e.flows.openDashboard({ uid: 'TkZXxlNG3' });
|
||||
e2e.flows.openPanelMenuItem(e2e.flows.PanelMenuItems.Edit, PANEL_UNDER_TEST);
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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 + "/")
|
||||
|
@ -74,7 +74,7 @@ func (u *S3Uploader) Upload(ctx context.Context, imageDiskPath string) (string,
|
||||
return "", err
|
||||
}
|
||||
key := u.path + rand + pngExt
|
||||
log.Debugf("Uploading image to s3. bucket = %s, path = %s", u.bucket, key)
|
||||
log.Debug("Uploading image to s3.", "bucket", u.bucket, "path", key)
|
||||
|
||||
// We can ignore the gosec G304 warning on this one because `imageDiskPath` comes
|
||||
// from alert notifiers and is only used to upload images generated by alerting.
|
||||
|
@ -84,6 +84,14 @@ func Warnf(format string, v ...interface{}) {
|
||||
Root.Warn(message)
|
||||
}
|
||||
|
||||
func Debug(msg string, args ...interface{}) {
|
||||
Root.Debug(msg, args...)
|
||||
}
|
||||
|
||||
func Info(msg string, args ...interface{}) {
|
||||
Root.Info(msg, args...)
|
||||
}
|
||||
|
||||
func Error(msg string, args ...interface{}) {
|
||||
Root.Error(msg, args...)
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ func (s *SocialBase) httpGet(client *http.Client, url string) (response httpGetR
|
||||
return
|
||||
}
|
||||
|
||||
log.Tracef("HTTP GET %s: %s %s", url, r.Status, string(response.Body))
|
||||
log.Debug("HTTP GET", "url", url, "status", r.Status, "response_body", string(response.Body))
|
||||
|
||||
err = nil
|
||||
return
|
||||
|
@ -49,7 +49,7 @@ func (pm *PluginManager) checkForUpdates() {
|
||||
pluginSlugs := pm.getAllExternalPluginSlugs()
|
||||
resp, err := httpClient.Get("https://grafana.com/api/plugins/versioncheck?slugIn=" + pluginSlugs + "&grafanaVersion=" + setting.BuildVersion)
|
||||
if err != nil {
|
||||
log.Tracef("Failed to get plugins repo from grafana.com, %v", err.Error())
|
||||
log.Debug("Failed to get plugins repo from grafana.com", "error", err.Error())
|
||||
return
|
||||
}
|
||||
defer func() {
|
||||
@ -60,14 +60,14 @@ func (pm *PluginManager) checkForUpdates() {
|
||||
|
||||
body, err := ioutil.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
log.Tracef("Update check failed, reading response from grafana.com, %v", err.Error())
|
||||
log.Debug("Update check failed, reading response from grafana.com", "error", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
gNetPlugins := []grafanaNetPlugin{}
|
||||
err = json.Unmarshal(body, &gNetPlugins)
|
||||
if err != nil {
|
||||
log.Tracef("Failed to unmarshal plugin repo, reading response from grafana.com, %v", err.Error())
|
||||
log.Debug("Failed to unmarshal plugin repo, reading response from grafana.com", "error", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
@ -90,7 +90,7 @@ func (pm *PluginManager) checkForUpdates() {
|
||||
|
||||
resp2, err := httpClient.Get("https://raw.githubusercontent.com/grafana/grafana/main/latest.json")
|
||||
if err != nil {
|
||||
log.Tracef("Failed to get latest.json repo from github.com: %v", err.Error())
|
||||
log.Debug("Failed to get latest.json repo from github.com", "error", err.Error())
|
||||
return
|
||||
}
|
||||
defer func() {
|
||||
@ -100,14 +100,14 @@ func (pm *PluginManager) checkForUpdates() {
|
||||
}()
|
||||
body, err = ioutil.ReadAll(resp2.Body)
|
||||
if err != nil {
|
||||
log.Tracef("Update check failed, reading response from github.com, %v", err.Error())
|
||||
log.Debug("Update check failed, reading response from github.com", "error", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
var latest gitHubLatest
|
||||
err = json.Unmarshal(body, &latest)
|
||||
if err != nil {
|
||||
log.Tracef("Failed to unmarshal github.com latest, reading response from github.com: %v", err.Error())
|
||||
log.Debug("Failed to unmarshal github.com latest, reading response from github.com", "error", err.Error())
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,7 @@ func (ac *OSSAccessControlService) saveFixedRole(role accesscontrol.RoleDTO) {
|
||||
// needs to be increased. Hence, we don't overwrite a role with a
|
||||
// greater version.
|
||||
if storedRole.Version >= role.Version {
|
||||
log.Debugf("role %v has already been stored in a greater version, skipping registration", role.Name)
|
||||
log.Debug("the has already been stored in a greater version, skipping registration", "role", role.Name)
|
||||
return
|
||||
}
|
||||
}
|
||||
@ -150,7 +150,7 @@ func (ac *OSSAccessControlService) assignFixedRole(role accesscontrol.RoleDTO, b
|
||||
if ok {
|
||||
for _, assignedRole := range assignments {
|
||||
if assignedRole == role.Name {
|
||||
log.Debugf("role %v has already been assigned to %v", role.Name, builtInRole)
|
||||
log.Debug("the role has already been assigned", "rolename", role.Name, "build_in_role", builtInRole)
|
||||
alreadyAssigned = true
|
||||
}
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ func appendIfPossible(message string, extra string, sizeLimit int) string {
|
||||
if len(extra)+len(message) <= sizeLimit {
|
||||
return message + extra
|
||||
}
|
||||
log.Debugf("Line too long for image caption. value: %s", extra)
|
||||
log.Debug("Line too long for image caption.", "value", extra)
|
||||
return message
|
||||
}
|
||||
|
||||
|
@ -148,7 +148,7 @@ func (h *ContextHandler) initContextWithAnonymousUser(reqContext *models.ReqCont
|
||||
|
||||
org, err := h.SQLStore.GetOrgByName(h.Cfg.AnonymousOrgName)
|
||||
if err != nil {
|
||||
log.Errorf(3, "Anonymous access organization error: '%s': %s", h.Cfg.AnonymousOrgName, err)
|
||||
log.Error("Anonymous access organization error.", "org_name", h.Cfg.AnonymousOrgName, "error", err)
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -56,13 +56,13 @@ func (ls *Implementation) UpsertUser(cmd *models.UpsertUserCommand) error {
|
||||
return err
|
||||
}
|
||||
if !cmd.SignupAllowed {
|
||||
log.Warnf("Not allowing %s login, user not found in internal user database and allow signup = false", extUser.AuthModule)
|
||||
log.Warn("Not allowing login, user not found in internal user database and allow signup = false", "authmode", extUser.AuthModule)
|
||||
return login.ErrInvalidCredentials
|
||||
}
|
||||
|
||||
limitReached, err := ls.QuotaService.QuotaReached(cmd.ReqContext, "user")
|
||||
if err != nil {
|
||||
log.Warnf("Error getting user quota. error: %v", err)
|
||||
log.Warn("Error getting user quota.", "error", err)
|
||||
return login.ErrGettingUserQuota
|
||||
}
|
||||
if limitReached {
|
||||
|
@ -26,7 +26,7 @@ func (o *OSSSearchUserFilter) GetFilter(filterName string, params []string) mode
|
||||
}
|
||||
filter, err := f(params)
|
||||
if err != nil {
|
||||
log.Warnf("Cannot initialise the filter %s: %s", filterName, err)
|
||||
log.Warn("Cannot initialise the filter.", "filter", filterName, "error", err)
|
||||
return nil
|
||||
}
|
||||
return filter
|
||||
|
@ -1,6 +1,8 @@
|
||||
package ualert
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/grafana/grafana/pkg/infra/log"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
@ -16,7 +18,8 @@ func (s SecureJsonData) DecryptedValue(key string) (string, bool) {
|
||||
if value, ok := s[key]; ok {
|
||||
decryptedData, err := util.Decrypt(value, setting.SecretKey)
|
||||
if err != nil {
|
||||
log.Fatalf(4, err.Error())
|
||||
log.Error(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
return string(decryptedData), true
|
||||
}
|
||||
@ -30,7 +33,8 @@ func (s SecureJsonData) Decrypt() map[string]string {
|
||||
for key, data := range s {
|
||||
decryptedData, err := util.Decrypt(data, setting.SecretKey)
|
||||
if err != nil {
|
||||
log.Fatalf(4, err.Error())
|
||||
log.Error(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
decrypted[key] = string(decryptedData)
|
||||
@ -44,7 +48,8 @@ func GetEncryptedJsonData(sjd map[string]string) SecureJsonData {
|
||||
for key, data := range sjd {
|
||||
encryptedData, err := util.Encrypt([]byte(data), setting.SecretKey)
|
||||
if err != nil {
|
||||
log.Fatalf(4, err.Error())
|
||||
log.Error(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
encrypted[key] = encryptedData
|
||||
|
@ -48,7 +48,7 @@ func (e *MigrationError) Unwrap() error { return e.Err }
|
||||
func AddDashAlertMigration(mg *migrator.Migrator) {
|
||||
logs, err := mg.GetMigrationLog()
|
||||
if err != nil {
|
||||
mg.Logger.Crit("alert migration failure: could not get migration log", "error", err)
|
||||
mg.Logger.Error("alert migration failure: could not get migration log", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
@ -88,7 +88,7 @@ func AddDashAlertMigration(mg *migrator.Migrator) {
|
||||
func RerunDashAlertMigration(mg *migrator.Migrator) {
|
||||
logs, err := mg.GetMigrationLog()
|
||||
if err != nil {
|
||||
mg.Logger.Crit("alert migration failure: could not get migration log", "error", err)
|
||||
mg.Logger.Error("alert migration failure: could not get migration log", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
@ -109,7 +109,7 @@ func RerunDashAlertMigration(mg *migrator.Migrator) {
|
||||
func AddDashboardUIDPanelIDMigration(mg *migrator.Migrator) {
|
||||
logs, err := mg.GetMigrationLog()
|
||||
if err != nil {
|
||||
mg.Logger.Crit("alert migration failure: could not get migration log", "error", err)
|
||||
mg.Logger.Error("alert migration failure: could not get migration log", "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
@ -67,7 +67,7 @@ func inTransactionWithRetryCtx(ctx context.Context, engine *xorm.Engine, callbac
|
||||
if len(sess.events) > 0 {
|
||||
for _, e := range sess.events {
|
||||
if err = bus.Publish(e); err != nil {
|
||||
log.Errorf(3, "Failed to publish event after commit. error: %v", err)
|
||||
log.Error("Failed to publish event after commit.", "error", err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -464,7 +464,8 @@ func parseAppUrlAndSubUrl(section *ini.Section) (string, string, error) {
|
||||
// Check if has app suburl.
|
||||
url, err := url.Parse(appUrl)
|
||||
if err != nil {
|
||||
log.Fatalf(4, "Invalid root_url(%s): %s", appUrl, err)
|
||||
log.Error("Invalid root_url.", "url", appUrl, "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
appSubUrl := strings.TrimSuffix(url.Path, "/")
|
||||
@ -631,8 +632,8 @@ func getCommandLineProperties(args []string) map[string]string {
|
||||
trimmed := strings.TrimPrefix(arg, "cfg:")
|
||||
parts := strings.Split(trimmed, "=")
|
||||
if len(parts) != 2 {
|
||||
log.Fatalf(3, "Invalid command line argument. argument: %v", arg)
|
||||
return nil
|
||||
log.Error("Invalid command line argument.", "argument", arg)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
props[parts[0]] = parts[1]
|
||||
@ -718,7 +719,8 @@ func (cfg *Cfg) loadConfiguration(args CommandLineArgs) (*ini.File, error) {
|
||||
if err2 != nil {
|
||||
return nil, err2
|
||||
}
|
||||
log.Fatalf(3, err.Error())
|
||||
log.Error(err.Error())
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// apply environment overrides
|
||||
@ -961,7 +963,7 @@ func (cfg *Cfg) Load(args CommandLineArgs) error {
|
||||
cfg.readDataSourcesSettings()
|
||||
|
||||
if VerifyEmailEnabled && !cfg.Smtp.Enabled {
|
||||
log.Warnf("require_email_validation is enabled but smtp is disabled")
|
||||
log.Warn("require_email_validation is enabled but smtp is disabled")
|
||||
}
|
||||
|
||||
// check old key name
|
||||
@ -1356,7 +1358,8 @@ func (cfg *Cfg) readRenderingSettings(iniFile *ini.File) error {
|
||||
_, err := url.Parse(cfg.RendererCallbackUrl)
|
||||
if err != nil {
|
||||
// XXX: Should return an error?
|
||||
log.Fatalf(4, "Invalid callback_url(%s): %s", cfg.RendererCallbackUrl, err)
|
||||
log.Error("Invalid callback_url.", "url", cfg.RendererCallbackUrl, "error", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user