This is an automated email from the ASF dual-hosted git repository.
lostluck pushed a commit to branch lostluck-protosuffix
in repository https://gitbox.apache.org/repos/asf/beam.git
The following commit(s) were added to refs/heads/lostluck-protosuffix by this
push:
new 1894be7 Update logging.go
1894be7 is described below
commit 1894be70b247d16217750906fd452757d9e24a30
Author: Robert Burke <[email protected]>
AuthorDate: Tue Apr 7 22:34:33 2020 -0700
Update logging.go
---
sdks/go/pkg/beam/core/runtime/harness/logging.go | 30 ++++++++++++------------
1 file changed, 15 insertions(+), 15 deletions(-)
diff --git a/sdks/go/pkg/beam/core/runtime/harness/logging.go
b/sdks/go/pkg/beam/core/runtime/harness/logging.go
index 2a1d0fa..d6cd31c 100644
--- a/sdks/go/pkg/beam/core/runtime/harness/logging.go
+++ b/sdks/go/pkg/beam/core/runtime/harness/logging.go
@@ -24,7 +24,7 @@ import (
"github.com/apache/beam/sdks/go/pkg/beam/internal/errors"
"github.com/apache/beam/sdks/go/pkg/beam/log"
- pb "github.com/apache/beam/sdks/go/pkg/beam/model/fnexecution_v1"
+ fnpb "github.com/apache/beam/sdks/go/pkg/beam/model/fnexecution_v1"
"github.com/golang/protobuf/ptypes"
)
@@ -50,13 +50,13 @@ func tryGetInstID(ctx context.Context) (string, bool) {
}
type logger struct {
- out chan<- *pb.LogEntry
+ out chan<- *fnpb.LogEntry
}
func (l *logger) Log(ctx context.Context, sev log.Severity, calldepth int, msg
string) {
now, _ := ptypes.TimestampProto(time.Now())
- entry := &pb.LogEntry{
+ entry := &fnpb.LogEntry{
Timestamp: now,
Severity: convertSeverity(sev),
Message: msg,
@@ -77,27 +77,27 @@ func (l *logger) Log(ctx context.Context, sev log.Severity,
calldepth int, msg s
}
}
-func convertSeverity(sev log.Severity) pb.LogEntry_Severity_Enum {
+func convertSeverity(sev log.Severity) fnpb.LogEntry_Severity_Enum {
switch sev {
case log.SevDebug:
- return pb.LogEntry_Severity_DEBUG
+ return fnpb.LogEntry_Severity_DEBUG
case log.SevInfo:
- return pb.LogEntry_Severity_INFO
+ return fnpb.LogEntry_Severity_INFO
case log.SevWarn:
- return pb.LogEntry_Severity_WARN
+ return fnpb.LogEntry_Severity_WARN
case log.SevError:
- return pb.LogEntry_Severity_ERROR
+ return fnpb.LogEntry_Severity_ERROR
case log.SevFatal:
- return pb.LogEntry_Severity_CRITICAL
+ return fnpb.LogEntry_Severity_CRITICAL
default:
- return pb.LogEntry_Severity_INFO
+ return fnpb.LogEntry_Severity_INFO
}
}
// setupRemoteLogging redirects local log messages to FnHarness. It will
// try to reconnect, if a connection goes bad. Falls back to stdout.
func setupRemoteLogging(ctx context.Context, endpoint string) {
- buf := make(chan *pb.LogEntry, 2000)
+ buf := make(chan *fnpb.LogEntry, 2000)
log.SetLogger(&logger{out: buf})
w := &remoteWriter{buf, endpoint}
@@ -105,7 +105,7 @@ func setupRemoteLogging(ctx context.Context, endpoint
string) {
}
type remoteWriter struct {
- buffer chan *pb.LogEntry
+ buffer chan *fnpb.LogEntry
endpoint string
}
@@ -125,7 +125,7 @@ func (w *remoteWriter) connect(ctx context.Context) error {
}
defer conn.Close()
- client, err := pb.NewBeamFnLoggingClient(conn).Logging(ctx)
+ client, err := fnpb.NewBeamFnLoggingClient(conn).Logging(ctx)
if err != nil {
return err
}
@@ -136,8 +136,8 @@ func (w *remoteWriter) connect(ctx context.Context) error {
// TODO: batch up log messages
- list := &pb.LogEntry_List{
- LogEntries: []*pb.LogEntry{msg},
+ list := &fnpb.LogEntry_List{
+ LogEntries: []*fnpb.LogEntry{msg},
}
recordLogEntries(list)