mirror of
https://github.com/psviderski/uncloud.git
synced 2026-10-07 13:49:02 +00:00
fix(logs): show all matched logs when --since filter specified
This commit is contained in:
1 parent
5fa236871f
commit
409dc3bfe3
5 files changed
+61
-15
No files matched your search
+1
-1
@@ -305,7 +305,7 @@ const defaultFailedContainerLogsTail = 10
|
||||
// UNCLOUD_FAILED_CONTAINER_LOGS_TAIL environment variable override when set and valid.
|
||||
func failedContainerLogsTail() int {
|
||||
if v := os.Getenv("UNCLOUD_FAILED_CONTAINER_LOGS_TAIL"); v != "" {
|
||||
if tail, err := logs.Tail(v); err == nil && (tail == -1 || tail > 0) {
|
||||
if tail, err := logs.ParseTail(v); err == nil && (tail == -1 || tail > 0) {
|
||||
return tail
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,6 +69,10 @@ func runLogs(ctx context.Context, uncli *cli.CLI, services []string, opts logs.O
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tail, err := opts.TailLines()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if len(services) == 0 {
|
||||
services = []string{api.SystemServiceUncloud}
|
||||
@@ -80,11 +84,6 @@ func runLogs(ctx context.Context, uncli *cli.CLI, services []string, opts logs.O
|
||||
}
|
||||
}
|
||||
|
||||
tail, err := logs.Tail(opts.Tail)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := uncli.ConnectCluster(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("connect to cluster: %w", err)
|
||||
|
||||
@@ -83,6 +83,10 @@ func RunLogs(ctx context.Context, uncli *cli.CLI, args []string, opts logs.Optio
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
tail, err := opts.TailLines()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
serviceArgs, err := logs.ParseServiceArgs(args)
|
||||
if err != nil {
|
||||
@@ -112,12 +116,6 @@ func RunLogs(ctx context.Context, uncli *cli.CLI, args []string, opts logs.Optio
|
||||
}
|
||||
}
|
||||
|
||||
// Parse tail option.
|
||||
tail, err := logs.Tail(opts.Tail)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
c, err := uncli.ConnectCluster(ctx)
|
||||
if err != nil {
|
||||
return fmt.Errorf("connect to cluster: %w", err)
|
||||
|
||||
Reference in new issue
Block a user