Last active
August 21, 2016 22:47
-
-
Save ammario/eb958553b4d389529d699da032f93160 to your computer and use it in GitHub Desktop.
Connect to Google Cloud with logging
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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