Skip to content

Commit

Permalink
Improve warning of no logs when using filter for logs list (#733)
Browse files Browse the repository at this point in the history
  • Loading branch information
sergiught authored Apr 13, 2023
1 parent c311de4 commit 59a0cad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion internal/cli/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
}
Expand Down
9 changes: 7 additions & 2 deletions internal/display/logs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 59a0cad

Please sign in to comment.