docs

package
v0.5.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 3, 2021 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package docs holds go code for inclusion into the prose documentation.

The documentation is available online at https://quay.github.io/claircore/

Example (Logger)

Example_logger is an example annotated for inclusion in the prose documentation.

package main

import (
	"context"
	"time"

	"github.com/quay/zlog"
	"go.opentelemetry.io/otel/baggage"
	"go.opentelemetry.io/otel/label"
)

func main() {
	ctx := context.Background()
	// ANCHOR: kvs
	ctx = baggage.ContextWithValues(ctx,
		label.String("component", "Example.Logger"))
	// ANCHOR_END: kvs

	// ANCHOR: bad_example
	zlog.Info(ctx).Msgf("done at: %v", time.Now())
	// ANCHOR_END: bad_example
	// ANCHOR: good_example
	zlog.Info(ctx).
		Time("time", time.Now()).
		Msgf("done")
	// ANCHOR_END: good_example
}
Output:

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL