| OLD | NEW |
| 1 // Copyright 2015 The LUCI Authors. All rights reserved. | 1 // Copyright 2015 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package main | 5 package main |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 log "github.com/luci/luci-go/common/logging" | 8 log "github.com/luci/luci-go/common/logging" |
| 9 "github.com/luci/luci-go/logdog/client/butler" | 9 "github.com/luci/luci-go/logdog/client/butler" |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 return configErrorReturnCode | 42 return configErrorReturnCode |
| 43 } | 43 } |
| 44 streamServer := createStreamServer(a, cmd.uri) | 44 streamServer := createStreamServer(a, cmd.uri) |
| 45 | 45 |
| 46 if err := streamServer.Listen(); err != nil { | 46 if err := streamServer.Listen(); err != nil { |
| 47 log.Errorf(log.SetError(a, err), "Failed to connect to stream se
rver.") | 47 log.Errorf(log.SetError(a, err), "Failed to connect to stream se
rver.") |
| 48 return runtimeErrorReturnCode | 48 return runtimeErrorReturnCode |
| 49 } | 49 } |
| 50 | 50 |
| 51 // We think everything will work. Configure our Output instance. | 51 // We think everything will work. Configure our Output instance. |
| 52 » output, err := a.configOutput() | 52 » of, err := a.getOutputFactory() |
| 53 » if err != nil { |
| 54 » » log.WithError(err).Errorf(a, "Failed to get output factory insta
nce.") |
| 55 » » return runtimeErrorReturnCode |
| 56 » } |
| 57 » output, err := of.configOutput(a) |
| 53 if err != nil { | 58 if err != nil { |
| 54 log.WithError(err).Errorf(a, "Failed to create output instance."
) | 59 log.WithError(err).Errorf(a, "Failed to create output instance."
) |
| 55 return runtimeErrorReturnCode | 60 return runtimeErrorReturnCode |
| 56 } | 61 } |
| 57 defer output.Close() | 62 defer output.Close() |
| 58 | 63 |
| 59 err = a.runWithButler(a, output, func(ctx context.Context, b *butler.But
ler) error { | 64 err = a.runWithButler(a, output, func(ctx context.Context, b *butler.But
ler) error { |
| 60 b.AddStreamServer(streamServer) | 65 b.AddStreamServer(streamServer) |
| 61 return b.Wait() | 66 return b.Wait() |
| 62 }) | 67 }) |
| 63 if err != nil { | 68 if err != nil { |
| 64 logAnnotatedErr(a, err, "Failed to serve.") | 69 logAnnotatedErr(a, err, "Failed to serve.") |
| 65 return runtimeErrorReturnCode | 70 return runtimeErrorReturnCode |
| 66 } | 71 } |
| 67 | 72 |
| 68 return 0 | 73 return 0 |
| 69 } | 74 } |
| OLD | NEW |