No description or website provided.
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
AUTHORS
LICENSE
README.md
go.mod
go.sum
grouplogger.go
grouplogger_test.go

README.md

grouplogger

GoDoc

Grouplogger is a specialized Stackdriver logging client for writing groups of log entries. Group entries by contexts that make sense for your application––e.g. by Stackdriver Trace, HTTP request, or Pub/Sub message.

(Stackdriver documentation: Viewing related request log entries)

u, _ := url.Parse("https://api.vimeo.com/")

// Stackdriver requires a non-nil http.Request.
req := &http.Request{
  // Including a trace ID is optional.
  Header: http.Header{
    "X-Cloud-Trace-Context": []string{"your-trace-id"},
  },
  // Stackdriver requires the http.Request to have a URL.
  URL: u,
}

ctx := context.Background()
cli, _ := grouplogger.NewClient(ctx, "your-project-id")

logger := cli.Logger(req, "logname")

logger.Info("Entry with Info severity.")
logger.Notice(map[string][]string{
  "Words": []string{"structured", "data", "in", "entries"},
})
logger.Warning("Look out! Entry with Warning severity.")

logger.Close()

_ = cli.Close()

screen shot 2018-07-31 at 12 33 06 pm