Commit c58a1590 authored by 王明明's avatar 王明明

修改日志区分

parent 3359d2e6
package main
import (
"flag"
"fmt"
nested "github.com/antonfisher/nested-logrus-formatter"
"github.com/gorilla/mux"
......@@ -18,6 +19,8 @@ func WelcomeHandler(w http.ResponseWriter, r *http.Request) {
}
func main() {
logname := flag.String("logname", "akm.log", "日志文件名")
flag.Parse()
logrus.SetLevel(logrus.TraceLevel)
//logrus.SetFormatter(&logrus.TextFormatter{
// //HideKeys: true,
......@@ -31,9 +34,10 @@ func main() {
NoColors: true,
})
logFilePath := util.GetCurrentAbPathByCaller()
logFileName := "akm.log"
fileName := path.Join(logFilePath, logFileName)
logFileName := *logname
fileName := path.Join(logFilePath, logFileName)
fmt.Println("日志文件路径 ", fileName)
// 写入文件
//src, err := os.OpenFile(fileName+".log", os.O_APPEND|os.O_WRONLY|os.O_CREATE, os.ModeAppend)
......
export GOPROXY=https://goproxy.cn
cd /root/src/js && npm i && nohup /usr/local/bin/node --expose-gc --max-old-space-size=256 --max-new-space-size=1024 run.js > 1.log 2>&1 &
cd /root/src && go run main.go
\ No newline at end of file
cd /root/src/js && npm i && nohup /usr/local/bin/node --expose-gc --max-old-space-size=256 run.js > 1.log 2>&1 &
cd /root/src && go run main.go --logname=$logname
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment