log

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 15, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogCmd = &cobra.Command{
	Use:     "log [SERVER NAME]",
	Aliases: []string{"logs"},
	Short:   "Retrieve and display server logs",
	Long: `Retrieve and display logs for a specified server. This command allows you 
	to view logs of different levels and types associated with a server. Use the '--tail' flag 
	to limit the output to the last N log entries. Suitable for debugging and monitoring 
	server activities.`,
	Example: `
	alpacon log [SERVER NAME]
	alpacon logs [SERVER_NAME]
	alpacon log [SERVER NAME] --tail=10
	alpacon logs [SERVER NAME] --tail=10
	`,
	Args: cobra.ExactArgs(1),
	Run: func(cmd *cobra.Command, args []string) {
		serverName := args[0]

		alpaconClient, err := client.NewAlpaconAPIClient()
		if err != nil {
			utils.CliError("Connection to Alpacon API failed: %s. Consider re-logging.", err)
		}

		logList, err := log.GetSystemLogList(alpaconClient, serverName, pageSize)
		if err != nil {
			utils.CliError("Failed to get logs %s", err)
		}

		utils.PrintTable(logList)
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL