mirror of
https://github.com/clearlinux/docker.git
synced 2026-09-07 14:32:09 +00:00
Implement tail for docker logs
Fixes #4330 Docker-DCO-1.1-Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com> (github: LK4D4)
This commit is contained in:
@@ -1693,6 +1693,7 @@ func (cli *DockerCli) CmdLogs(args ...string) error {
|
||||
cmd = cli.Subcmd("logs", "CONTAINER", "Fetch the logs of a container")
|
||||
follow = cmd.Bool([]string{"f", "-follow"}, false, "Follow log output")
|
||||
times = cmd.Bool([]string{"t", "-timestamps"}, false, "Show timestamps")
|
||||
tail = cmd.String([]string{"-tail"}, "all", "Output the specified number of lines at the end of logs(all logs by default)")
|
||||
)
|
||||
|
||||
if err := cmd.Parse(args); err != nil {
|
||||
@@ -1726,6 +1727,7 @@ func (cli *DockerCli) CmdLogs(args ...string) error {
|
||||
if *follow {
|
||||
v.Set("follow", "1")
|
||||
}
|
||||
v.Set("tail", *tail)
|
||||
|
||||
return cli.streamHelper("GET", "/containers/"+name+"/logs?"+v.Encode(), env.GetSubEnv("Config").GetBool("Tty"), nil, cli.out, cli.err, nil)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user