From 59a0cadd92fd7ec22db7f7361a4dcfe78aa1bdce Mon Sep 17 00:00:00 2001 From: Sergiu Ghitea <28300158+sergiught@users.noreply.github.com> Date: Thu, 13 Apr 2023 10:28:03 +0200 Subject: [PATCH] Improve warning of no logs when using filter for logs list (#733) --- internal/cli/logs.go | 3 ++- internal/display/logs.go | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/internal/cli/logs.go b/internal/cli/logs.go index f7d3d82bd..c8b164534 100644 --- a/internal/cli/logs.go +++ b/internal/cli/logs.go @@ -66,7 +66,8 @@ func listLogsCmd(cli *cli) *cobra.Command { return fmt.Errorf("An unexpected error occurred while getting logs: %v", err) } - cli.renderer.LogList(list, !cli.debug) + hasFilter := inputs.Filter != "" + cli.renderer.LogList(list, !cli.debug, hasFilter) return nil }, } diff --git a/internal/display/logs.go b/internal/display/logs.go index 906c51c45..b65b398a7 100644 --- a/internal/display/logs.go +++ b/internal/display/logs.go @@ -142,13 +142,18 @@ func (v *logView) typeDesc() (typ, desc string) { return typ, desc } -func (r *Renderer) LogList(logs []*management.Log, silent bool) { +func (r *Renderer) LogList(logs []*management.Log, silent, hasFilter bool) { resource := "logs" r.Heading(resource) if len(logs) == 0 { - r.EmptyState(resource) + if hasFilter { + r.Output("No logs available matching filter criteria.\n\n") + } else { + r.EmptyState(resource) + } + r.Infof("To generate logs, run a test command like 'auth0 test login' or 'auth0 test token'") return }