log

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 28, 2026 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var LogCmd = &cobra.Command{
	Use:     "log SERVER",
	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 my-server
	alpacon logs my-server
	alpacon log my-server --tail=10
	alpacon logs my-server --tail=10
	`,
	Args: cobra.ExactArgs(1),
	Run: func(cmd *cobra.Command, args []string) {
		serverName := args[0]
		pageSize, _ := cmd.Flags().GetInt("tail")

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

		logList, err := log.GetSystemLogList(alpaconClient, serverName, pageSize)
		if err != nil {
			utils.CliErrorWithExit("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