Documentation ¶
Overview ¶
Package log supports structured and unstructured logging with levels to GCP stackdriver.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(ctx context.Context, logName, projectID string, opts []logging.LoggerOption) (_ log.Logger, _ *logging.Logger, err error)
New creates a new Logger that logs to Stackdriver. It assumes config.Init has been called. New returns a "parent" *logging.Logger that should be used to log the start and end of a request. It also creates and remembers internally a "child" log.Logger that will be used to log within a request. The child logger should be passed to log.Use to forward the log package's logging calls to the child logger. The two loggers are necessary to get request-scoped logs in Stackdriver. See https://cloud.google.com/appengine/docs/standard/go/writing-application-logs.
New can only be called once. If it is called a second time, it returns an error.
func NewContextWithLabel ¶
NewContextWithLabel creates a new context from ctx that adds a label that will appear in the log entry.
Types ¶
This section is empty.