|
1 | | -/* |
2 | | - Copyright 2017, Google, Inc. |
3 | | - Licensed under the Apache License, Version 2.0 (the "License"); |
4 | | - you may not use this file except in compliance with the License. |
5 | | - You may obtain a copy of the License at |
6 | | -
|
7 | | - http://www.apache.org/licenses/LICENSE-2.0 |
8 | | -
|
9 | | - Unless required by applicable law or agreed to in writing, software |
10 | | - distributed under the License is distributed on an "AS IS" BASIS, |
11 | | - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 | | - See the License for the specific language governing permissions and |
13 | | - limitations under the License. |
14 | | -*/ |
| 1 | +// Copyright 2017, Google, Inc. |
| 2 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | +// you may not use this file except in compliance with the License. |
| 4 | +// You may obtain a copy of the License at |
| 5 | +// |
| 6 | +// http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | +// |
| 8 | +// Unless required by applicable law or agreed to in writing, software |
| 9 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | +// See the License for the specific language governing permissions and |
| 12 | +// limitations under the License. |
15 | 13 |
|
16 | 14 | // Command logpipe is a service that will let you pipe logs directly to Stackdriver Logging. |
17 | 15 | package main |
@@ -55,6 +53,8 @@ func main() { |
55 | 53 | if err != nil { |
56 | 54 | errorf("Failed to create client: %v", err) |
57 | 55 | } |
| 56 | + errc := make(chan error) |
| 57 | + client.OnError = func(err error) { errc <- err } |
58 | 58 |
|
59 | 59 | ctx, cancel := context.WithTimeout(ctx, 1*time.Second) |
60 | 60 | defer cancel() |
|
90 | 90 | } |
91 | 91 | logger.Log(logging.Entry{Payload: line}) |
92 | 92 | case s := <-signals: |
93 | | - fmt.Fprintf(os.Stderr, "Terminating program after received signal: %v\n", s) |
| 93 | + fmt.Fprintf(os.Stderr, "Terminating program after receiving signal: %v\n", s) |
94 | 94 | break loop |
95 | 95 | } |
96 | 96 | } |
|
0 commit comments