mirror of
https://github.com/openfaas/faasd.git
synced 2025-06-08 16:06:47 +00:00
The collect command redirects function logs to the journal for viewing on journalctl. faas-cli logs is not implemented as of yet. View logs with journalctl -t openfaas-fn:FN_NAME_HERE. Tested on Dell XPS with Ubuntu Linux. The approach takes inspiration from the Stellar project. Signed-off-by: Alex Ellis (OpenFaaS Ltd) <alexellis2@gmail.com>
39 lines
646 B
Go
39 lines
646 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/openfaas/faasd/cmd"
|
|
)
|
|
|
|
// These values will be injected into these variables at the build time.
|
|
var (
|
|
// GitCommit Git Commit SHA
|
|
GitCommit string
|
|
// Version version of the CLI
|
|
Version string
|
|
)
|
|
|
|
func main() {
|
|
|
|
if _, ok := os.LookupEnv("CONTAINER_ID"); ok {
|
|
collect := cmd.RootCommand()
|
|
collect.SetArgs([]string{"collect"})
|
|
collect.SilenceUsage = true
|
|
collect.SilenceErrors = true
|
|
|
|
err := collect.Execute()
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, err.Error())
|
|
os.Exit(1)
|
|
}
|
|
os.Exit(0)
|
|
}
|
|
|
|
if err := cmd.Execute(Version, GitCommit); err != nil {
|
|
os.Exit(1)
|
|
}
|
|
return
|
|
}
|