| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. |
| 4 |
| 5 // eventlog is an example that demonstrates how to log to the eventlog service. |
| 6 // It logs to a locally-run server. See go/localeventlog for more information. |
| 7 package main |
| 8 |
| 9 import ( |
| 10 "fmt" |
| 11 "time" |
| 12 |
| 13 "golang.org/x/net/context" |
| 14 |
| 15 "github.com/luci/luci-go/common/eventlog" |
| 16 logpb "github.com/luci/luci-go/common/eventlog/proto" |
| 17 ) |
| 18 |
| 19 func main() { |
| 20 c := eventlog.NewClient("http://localhost:27910/log") |
| 21 ctx := context.Background() |
| 22 |
| 23 event := c.NewLogEvent(ctx, eventlog.TypedTime{time.Now(), logpb.ChromeI
nfraEvent_POINT}) |
| 24 |
| 25 // Log a build event. Other kinds of events may also be logged. |
| 26 event.InfraEvent.BuildEvent = &logpb.BuildEvent{ /* TODO:fill in content
s */ } |
| 27 |
| 28 err := c.LogSync(ctx, []*eventlog.ChromeInfraLogEvent{event}) |
| 29 if err != nil { |
| 30 fmt.Printf("logging: %v\n", err) |
| 31 } |
| 32 } |
| OLD | NEW |