@@ -17,6 +17,7 @@ limitations under the License.
17
17
package main
18
18
19
19
import (
20
+ "context"
20
21
"fmt"
21
22
"os"
22
23
"time"
@@ -59,25 +60,25 @@ var logsCommand = cli.Command{
59
60
Usage : "Show timestamps" ,
60
61
},
61
62
},
62
- Action : func (context * cli.Context ) error {
63
- runtimeService , err := getRuntimeService (context )
63
+ Action : func (ctx * cli.Context ) error {
64
+ runtimeService , err := getRuntimeService (ctx )
64
65
if err != nil {
65
66
return err
66
67
}
67
68
68
- containerID := context .Args ().First ()
69
+ containerID := ctx .Args ().First ()
69
70
if containerID == "" {
70
71
return fmt .Errorf ("ID cannot be empty" )
71
72
}
72
- tailLines := context .Int64 ("tail" )
73
- limitBytes := context .Int64 ("limit-bytes" )
74
- since , err := parseTimestamp (context .String ("since" ))
73
+ tailLines := ctx .Int64 ("tail" )
74
+ limitBytes := ctx .Int64 ("limit-bytes" )
75
+ since , err := parseTimestamp (ctx .String ("since" ))
75
76
if err != nil {
76
77
return err
77
78
}
78
- timestamp := context .Bool ("timestamps" )
79
+ timestamp := ctx .Bool ("timestamps" )
79
80
logOptions := logs .NewLogOptions (& v1.PodLogOptions {
80
- Follow : context .Bool ("follow" ),
81
+ Follow : ctx .Bool ("follow" ),
81
82
TailLines : & tailLines ,
82
83
LimitBytes : & limitBytes ,
83
84
SinceTime : since ,
@@ -91,7 +92,7 @@ var logsCommand = cli.Command{
91
92
if logPath == "" {
92
93
return fmt .Errorf ("The container has not set log path" )
93
94
}
94
- return logs .ReadLogs (logPath , status .GetId (), logOptions , runtimeService , os .Stdout , os .Stderr )
95
+ return logs .ReadLogs (context . Background (), logPath , status .GetId (), logOptions , runtimeService , os .Stdout , os .Stderr )
95
96
},
96
97
After : closeConnection ,
97
98
}
0 commit comments