Documentation ¶
Overview ¶
Package aelog provides the structured log of an application's logs from within an App Engine application.
Example:
ctx := r.Context() // r is *http.Request aelog.Infof(ctx, "info log. requestURL: %s", r.URL.String())
Index ¶
- func Criticalf(ctx context.Context, format string, a ...interface{})
- func Debugf(ctx context.Context, format string, a ...interface{})
- func Errorf(ctx context.Context, format string, a ...interface{})
- func Infof(ctx context.Context, format string, a ...interface{})
- func OutputJSON(ctx context.Context, severity, format string, a ...interface{})
- func OutputText(ctx context.Context, severity, format string, a ...interface{})
- func SetOutput(f func(context.Context, string, string, ...interface{}))
- func Warningf(ctx context.Context, format string, a ...interface{})
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Criticalf ¶
Criticalf is like Debugf, but the severity is critical level.
Example ¶
ctx := trace.NewContext(context.Background(), nil) Criticalf(ctx, "Criticalf: %s", "Sample Text")
Output: {"severity":"CRITICAL","message":"Criticalf: Sample Text","logging.googleapis.com/trace":"projects//traces/00000000000000000000000000000000","logging.googleapis.com/spanId":"0000000000000000"}
func Debugf ¶
Debugf formats its arguments according to the format, analogous to fmt.Printf, and records the text as log message at debug level. The log message will be associated with the platform request linked with the context.
Example ¶
ctx := trace.NewContext(context.Background(), nil) Debugf(ctx, "Debugf: %s", "Sample Text")
Output: {"severity":"DEBUG","message":"Debugf: Sample Text","logging.googleapis.com/trace":"projects//traces/00000000000000000000000000000000","logging.googleapis.com/spanId":"0000000000000000"}
func Errorf ¶
Errorf is like Debugf, but the severity is error level.
Example ¶
ctx := trace.NewContext(context.Background(), nil) Errorf(ctx, "Errorf: %s", "Sample Text")
Output: {"severity":"ERROR","message":"Errorf: Sample Text","logging.googleapis.com/trace":"projects//traces/00000000000000000000000000000000","logging.googleapis.com/spanId":"0000000000000000"}
func Infof ¶
Infof is like Debugf, but the severity is info level.
Example ¶
ctx := trace.NewContext(context.Background(), nil) Infof(ctx, "Infof: %s", "Sample Text")
Output: {"severity":"INFO","message":"Infof: Sample Text","logging.googleapis.com/trace":"projects//traces/00000000000000000000000000000000","logging.googleapis.com/spanId":"0000000000000000"}
func OutputJSON ¶
OutputJSON fills the fields required with the structured log described in https://cloud.google.com/logging/docs/agent/configuration#special-fields and outputs the log in json format.
func OutputText ¶
OutputText outputs log using standard log package.
func SetOutput ¶
SetOutput allows to set the log output format. The default log setting is json format.
func Warningf ¶
Warningf is like Debugf, but the severity is warning level.
Example ¶
ctx := trace.NewContext(context.Background(), nil) Warningf(ctx, "Warningf: %s", "Sample Text")
Output: {"severity":"WARNING","message":"Warningf: Sample Text","logging.googleapis.com/trace":"projects//traces/00000000000000000000000000000000","logging.googleapis.com/spanId":"0000000000000000"}
Types ¶
This section is empty.
Directories ¶
Path | Synopsis |
---|---|
internal
|
|
Package middleware provides the http.Handler with spancontext.
|
Package middleware provides the http.Handler with spancontext. |