The appengine package - Google App Engine
https://developers.google.com/appengine/docs/go/reference
import (
"appengine"
"net/http"
)
func init() {
http.HandleFunc("/", debug)
}
func debug(w http.ResponseWriter, r *http.Request) {
c := appengine.NewContext(r)
c.Debugf("Debug")
c.Infof("Infomation")
c.Warningf("Warning")
c.Criticalf("Critical")
}
c.Infof() や Debugf() でログを取ることができます。
ローカル開発よサーバの場合、コマンドプロンプトにログが出力されます。
本番環境の場合はアプリ管理画面にログが出力されます。
Debug だけ表示、Error だけ表示などのように絞込みも可能です。

0 件のコメント:
コメントを投稿