| Index: examples/eventlog/main.go
|
| diff --git a/examples/eventlog/main.go b/examples/eventlog/main.go
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..89a2c3959da19a3cdd55742ab2cabb828b7324cd
|
| --- /dev/null
|
| +++ b/examples/eventlog/main.go
|
| @@ -0,0 +1,31 @@
|
| +// Copyright 2016 The LUCI Authors. All rights reserved.
|
| +// Use of this source code is governed under the Apache License, Version 2.0
|
| +// that can be found in the LICENSE file.
|
| +
|
| +// eventlog is an example that demonstrates how to log to the eventlog service.
|
| +// It logs to a locally-run server. See go/localeventlog for more information.
|
| +package main
|
| +
|
| +import (
|
| + "fmt"
|
| +
|
| + "golang.org/x/net/context"
|
| +
|
| + "github.com/luci/luci-go/common/eventlog"
|
| + logpb "github.com/luci/luci-go/common/eventlog/proto"
|
| +)
|
| +
|
| +func main() {
|
| + c := eventlog.NewClient("http://localhost:27910/log")
|
| + ctx := context.Background()
|
| +
|
| + event := c.NewLogEvent(ctx, eventlog.Point())
|
| +
|
| + // Log a build event. Other kinds of events may also be logged.
|
| + event.InfraEvent.BuildEvent = &logpb.BuildEvent{ /* TODO:fill in contents */ }
|
| +
|
| + err := c.LogSync(ctx, event)
|
| + if err != nil {
|
| + fmt.Printf("logging: %v\n", err)
|
| + }
|
| +}
|
|
|