Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

modify args of logger so that it follows key/value pairs(Fixes #303 partially) #304

Merged
merged 1 commit into from
Jan 24, 2021

Conversation

sshota0809
Copy link
Contributor

@sshota0809 sshota0809 commented Jan 8, 2021

This PR includes "Fixes #303 (Partially)".

As I said in #303, when an error occurs in pkg/plugin.go, err object isn't expanded to %v. So I can't see detail error.

Example:

log.DefaultLogger.Info("Query run error: %v\n", err)

t=2021-01-06T11:53:01+0000 lvl=info msg="Query run error: %v\n" logger=plugins.backend pluginId=doitintl-bigquery-datasource

Logger in github.com/grafana/grafana-plugin-sdk-go/backend/log uses go-hclog(https://github.com/hashicorp/go-hclog). From README in go-hclog, args of logger should be specified as key/value pair.
https://github.com/hashicorp/go-hclog#emit-an-info-level-message-with-2-keyvalue-pairs

So I have modified args and confirmed err is expanded.

t=2021-01-08T00:34:22+0000 lvl=info msg="Query run error" logger=plugins.backend pluginId=doitintl-bigquery-datasource Error="googleapi: Error 404: Not found: Project a, notFound"

Would you check codes that I have modified? Thank you for looking my PR!

Fixes doitintl#303 partially

Signed-off-by: sshota0809 <8736380+sshota0809@users.noreply.github.com>
@LiorRacer LiorRacer merged commit 4977056 into doitintl:master Jan 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Occur Query run error when alerting
2 participants