This change introduces minimum log level support.
GO_DISCOVERY_LOG_LEVEL config can be used to set the log level.
When set, no logs below GO_DISCOVERY_LOG_LEVEL will be printed.
Possible log levels are debug, info, error, fatal.
Log severity sequence is debug < info < error < fatal.
In case of invalid/empty log level, it print all logs.
Fixesgolang/go#40339
Change-Id: I66116e6778eb6386bf1e8df6947078a78fece691
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/245797
Reviewed-by: Julie Qiu <julie@golang.org>
- Make it possible to add a label to a context, so it appears in all log messages.
- Add the module and version as a label when fetching.
This will make it easy to find all log messages related to the fetch
of a single module.
Change-Id: I6c564b6aa58a494180d61168e739ef62dd67a64c
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/760101
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
golang.org/x/discovery is renamed to golang.org/x/pkgsite.
When the repository is open sourced, it will be hosted at
go.googlesource.com/pkgsite.
Change-Id: Ifc3b45b771a385b99179e785447f2a87afcacf87
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/724273
Reviewed-by: Jonathan Amsterdam <jba@google.com>
As per the bug listed below, we are trying to remove the global cfg
variable from the config package. This CL brings us close to that
goal. There are still two uses of the global that are harder to remove.
Updates b/145301722.
Change-Id: Ia6c350ef5d817ff7fb3125cd207343d10911d64f
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/672580
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
- The requestlog middleware gets the trace ID from the request and
adds it to the request's context.
- The internal/log package retrieves the traceID and adds it to log
messages. It also creates two logs instead of one, a "parent" log
used in requestlog, and a "child" log used for all other logging.
Together, these two changes will cause the Stackdriver log viewer to
group all log messages for a request with the request start and end
log messages.
- These changes require that all log functions take a context, so I
plumbed one through everywhere. In a handful of cases it didn't seem
worth doing the plumbing. I used context.TODO() for those so we can
easily find and re-evalaute them.
Change-Id: I663588463520187d0549a8f802ba9cb44a893592
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/622940
Reviewed-by: Robert Findley <rfindley@google.com>
A few things are cleaned up related to our use of resource types:
+ clarify why we use the gae_app resource type instead of gae_instance for
logging. which has been abandoned, tried
to switch to gae_instance
+ set 'zone' instead of the incorrect 'zone_id' in our gae_app
monitored resources
+ don't set a monitored resource in the RequestLog middleware: it
should fall back on the common resource
Fixes b/145293043
Change-Id: I395a7046ef6bcbfbc7e5e02c767eb715b830c198
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/613500
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Jonathan Amsterdam <jba@google.com>
If we don't do this, then
log.Error(err)
could log as the empty JSON object, because the logging client will
try to serialize the value as JSON, and errors arising from
errors.New, fmt.Errorf, etc. have no exported fields.
Change-Id: If5a7c9da728ce23fbf279e15520371c4ae6e83db
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/558530
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Robert Findley <rfindley@google.com>
Use the new logger everywhere.
Also remove the Printf alias; it is easy enough to change all call sites.
Change-Id: I4f46c306e22f132cd505518a8d46b1a989f6bd1d
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/556722
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
It is intended as a drop-in replacement for the standard log
package, but also supports levels (just three for now)
and structured logging.
Also, converted etl/main.go as an example, to show usage.
If this is approved I'll convert everything else.
Change-Id: I8ee8855be05aafdd31cbf9b550aae76cb2240abe
Reviewed-on: https://team-review.git.corp.google.com/c/golang/discovery/+/556096
CI-Result: Cloud Build <devtools-proctor-result-processor@system.gserviceaccount.com>
Reviewed-by: Julie Qiu <julieqiu@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>