浏览代码

add security to cpu profile

abhishek9686 10 月之前
父节点
当前提交
bfc437bc9f
共有 1 个文件被更改,包括 4 次插入3 次删除
  1. 4 3
      logic/proc.go

+ 4 - 3
logic/proc.go

@@ -1,18 +1,19 @@
 package logic
 
 import (
-	"log"
 	"os"
 	"runtime/pprof"
+
+	"github.com/gravitl/netmaker/logger"
 )
 
 func StartCPUProfiling() *os.File {
 	f, err := os.OpenFile("/root/data/cpu.prof", os.O_APPEND|os.O_WRONLY|os.O_CREATE, 0755)
 	if err != nil {
-		log.Fatal("could not create CPU profile: ", err)
+		logger.Log(0, "could not create CPU profile: ", err.Error())
 	}
 	if err := pprof.StartCPUProfile(f); err != nil {
-		log.Fatal("could not start CPU profile: ", err)
+		logger.Log(0, "could not start CPU profile: ", err.Error())
 	}
 	return f
 }