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/rs/zerolog"
)
func main() {
ctx := context.Background()
// ANCHOR: logger
log := zerolog.Ctx(ctx).With().
// ANCHOR_END: logger
// ANCHOR: kvs
Str("component", "Example.Logger").
// ANCHOR_END: kvs
// ANCHOR: newlogger
Logger()
// ANCHOR_END: newlogger
// ANCHOR: context
ctx = log.WithContext(ctx)
// ANCHOR_END: context
// ANCHOR: bad_example
log.Info().Msgf("done at: %v", time.Now())
// ANCHOR_END: bad_example
// ANCHOR: good_example
log.Info().
Time("time", time.Now()).
Msgf("done")
// ANCHOR_END: good_example
}
Click to show internal directories.
Click to hide internal directories.