Skip to content

Instantly share code, notes, and snippets.

@ammario
Last active August 21, 2016 22:47
Show Gist options
  • Select an option

  • Save ammario/eb958553b4d389529d699da032f93160 to your computer and use it in GitHub Desktop.

Select an option

Save ammario/eb958553b4d389529d699da032f93160 to your computer and use it in GitHub Desktop.
Connect to Google Cloud with logging
package main
import (
"github.com/stratexio/gclog"
"golang.org/x/net/context"
"google.golang.org/cloud"
"google.golang.org/cloud/storage"
)
func main() {
//Make google cloud context
client := *http.DefaultClient
googleCtx := cloud.NewContext(os.Getenv("PROJECT"), &client)
//Establish logging client
err := gclog.SetClient(googleCtx, os.Getenv("PROJECT"), os.Getenv("HOSTNAME"))
if err != nil {
gclog.Criticalf("Error creating glog client: %v", err).Fatal()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment