Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add server log files selection #1345

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

feat: add server log files selection #1345

wants to merge 13 commits into from

Conversation

lbrecic
Copy link
Contributor

@lbrecic lbrecic commented Nov 16, 2024

Add server log files selection & list server logs command

Description

This PR introduces server log files selection for reading upon running daytona server logs command.
This naturally follows #1304 since now there is log rotation files that user might want to read from.
Log files included in selection follow instructions from lumberjack package where rotated log files are saved under <process_name>-<timestamp>.log or <process_name>-<timestamp>.zip if compression is enabled through log file configuration. (<process_name> in this case is daytona; main relevant log file daytona.log is also included in selection)

To avoid selection with non-interactive approach, user is able to specify a log file name using --file flag. In order to make this easier for user, this PR also introduces a daytona server logs list which outputs a list of log files from server.

  • This change requires a documentation update
  • I have made corresponding changes to the documentation

Related Issue(s)

Closes #1343

Screenrecording

Screen.Recording.2024-11-20.at.13.38.50.mov

@lbrecic lbrecic requested a review from a team as a code owner November 16, 2024 16:45
pkg/cmd/server/logs.go Outdated Show resolved Hide resolved
pkg/cmd/server/logs.go Outdated Show resolved Hide resolved
pkg/cmd/server/logs.go Outdated Show resolved Hide resolved
@lbrecic lbrecic requested a review from a team as a code owner November 19, 2024 16:32
@lbrecic lbrecic requested a review from Tpuljak November 19, 2024 16:32
Signed-off-by: Luka Brecic <[email protected]>
pkg/cmd/server/list_logs.go Outdated Show resolved Hide resolved
Signed-off-by: Luka Brecic <[email protected]>
@lbrecic lbrecic requested a review from Tpuljak November 20, 2024 12:42
pkg/cmd/server/logs.go Outdated Show resolved Hide resolved
pkg/cmd/server/logs.go Outdated Show resolved Hide resolved
pkg/cmd/server/logs.go Outdated Show resolved Hide resolved
pkg/cmd/server/logs.go Outdated Show resolved Hide resolved
pkg/cmd/server/logs.go Outdated Show resolved Hide resolved
Signed-off-by: Luka Brecic <[email protected]>
@lbrecic lbrecic requested a review from Tpuljak November 21, 2024 20:55
pkg/server/error.go Outdated Show resolved Hide resolved
Signed-off-by: Luka Brecic <[email protected]>
@lbrecic lbrecic requested a review from Tpuljak November 22, 2024 08:12
pkg/server/error.go Outdated Show resolved Hide resolved
Signed-off-by: Luka Brecic <[email protected]>
@lbrecic lbrecic requested a review from Tpuljak November 22, 2024 09:25
Tpuljak
Tpuljak previously approved these changes Nov 22, 2024
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this into the pkg/cmd/server/logs dir since it now has a subcommand - to match the rest of the CLI

var listCmd = &cobra.Command{
Use: "list",
Aliases: []string{"ls"},
Short: "Output Daytona Server logs",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a leftover description, should say "Lists Daytona Server log files.." or something similar

}
}

func getLogFileSelectionProgramEssentials(files []string) tea.Model {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would be in favour of merging this function with the one above

Signed-off-by: Luka Brecic <[email protected]>
Signed-off-by: Luka Brecic <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add selection functionality for server logs
3 participants