anonpenguin23 106c2df4d2 feat: implement wallet-based SSH authentication using Ed25519 keys
- Added documentation for wallet-based SSH authentication in WALLET_SSH_AUTH.md.
- Introduced SSH key derivation and management in rootwallet core and CLI.
- Created commands for generating, loading, and unloading SSH keys in the CLI.
- Updated Orama network to support SSH key authentication.
- Added migration steps for nodes to transition from password-based to key-based authentication.

feat: add serverless function management commands

- Implemented function command structure in CLI for managing serverless functions.
- Added commands for initializing, building, deploying, invoking, deleting, and listing functions.
- Created helper functions for handling function configuration and API requests.
- Integrated TinyGo for building functions to WASM.
- Added logging and version management for deployed functions.
2026-02-19 10:51:03 +02:00

58 lines
1.2 KiB
Go

package functions
import (
"fmt"
"strconv"
"github.com/spf13/cobra"
)
var logsLimit int
// LogsCmd retrieves function execution logs.
var LogsCmd = &cobra.Command{
Use: "logs <name>",
Short: "Get execution logs for a function",
Long: "Retrieves the most recent execution logs for a deployed function.",
Args: cobra.ExactArgs(1),
RunE: runLogs,
}
func init() {
LogsCmd.Flags().IntVar(&logsLimit, "limit", 50, "Maximum number of log entries to retrieve")
}
func runLogs(cmd *cobra.Command, args []string) error {
name := args[0]
endpoint := "/v1/functions/" + name + "/logs"
if logsLimit > 0 {
endpoint += "?limit=" + strconv.Itoa(logsLimit)
}
result, err := apiGet(endpoint)
if err != nil {
return err
}
logs, ok := result["logs"].([]interface{})
if !ok || len(logs) == 0 {
fmt.Printf("No logs found for function %q.\n", name)
return nil
}
for _, entry := range logs {
log, ok := entry.(map[string]interface{})
if !ok {
continue
}
ts := valStr(log, "timestamp")
level := valStr(log, "level")
msg := valStr(log, "message")
fmt.Printf("[%s] %s: %s\n", ts, level, msg)
}
fmt.Printf("\nShowing %d log(s)\n", len(logs))
return nil
}