change logging format
This commit is contained in:
13
main.go
13
main.go
@@ -6,6 +6,7 @@ import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"runtime"
|
||||
|
||||
"github.com/fatih/color"
|
||||
|
||||
@@ -30,9 +31,12 @@ func init() {
|
||||
config.Docker = flag.Bool("docker", false, "Create a docker project")
|
||||
config.Lib = lib
|
||||
config.Doc = documentation
|
||||
config.Verbose = flag.Bool("verbose", false, "Enable verbose logging")
|
||||
}
|
||||
|
||||
func main() {
|
||||
var m runtime.MemStats
|
||||
|
||||
flag.Usage = func() {
|
||||
fmt.Fprintf(flag.CommandLine.Output(), "Usage: %s [options] <command> <project_dir>\n", os.Args[0])
|
||||
fmt.Fprintln(flag.CommandLine.Output(), "Commands:")
|
||||
@@ -61,6 +65,10 @@ func main() {
|
||||
color.NoColor = true
|
||||
}
|
||||
|
||||
if *config.Port == 3000 {
|
||||
ui.WARNING("Using default port, this may lead to conflicts with other services")
|
||||
}
|
||||
|
||||
args := flag.Args()
|
||||
if len(args) < 1 {
|
||||
flag.Usage()
|
||||
@@ -90,7 +98,12 @@ func main() {
|
||||
os.Exit(1)
|
||||
}
|
||||
case "run":
|
||||
ui.Log("Fes is starting")
|
||||
ui.Log("Fes version=%s, commit=%s, just started", version.VERSION, version.GetCommit())
|
||||
|
||||
runtime.ReadMemStats(&m)
|
||||
ui.Log("FRE memory usage when created %v Mb", m.TotalAlloc/1024/1024)
|
||||
|
||||
if err := server.Start(dir); err != nil {
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
fmt.Fprintf(os.Stderr, "%s does not exist\n", dir)
|
||||
|
||||
Reference in New Issue
Block a user