Add debugging option to codebase
This commit is contained in:
parent
f53a30130b
commit
94f5a72e26
1 changed files with 20 additions and 1 deletions
21
main.go
21
main.go
|
@ -14,8 +14,27 @@
|
||||||
|
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import "github.com/abcum/surreal/cli"
|
import (
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/pkg/profile"
|
||||||
|
|
||||||
|
"github.com/abcum/surreal/cli"
|
||||||
|
)
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
|
switch os.Getenv("DEBUG") {
|
||||||
|
case "cpu":
|
||||||
|
defer profile.Start(profile.CPUProfile, profile.ProfilePath("."), profile.NoShutdownHook).Stop()
|
||||||
|
case "mem":
|
||||||
|
defer profile.Start(profile.MemProfile, profile.ProfilePath("."), profile.NoShutdownHook).Stop()
|
||||||
|
case "block":
|
||||||
|
defer profile.Start(profile.BlockProfile, profile.ProfilePath("."), profile.NoShutdownHook).Stop()
|
||||||
|
case "trace":
|
||||||
|
defer profile.Start(profile.TraceProfile, profile.ProfilePath("."), profile.NoShutdownHook).Stop()
|
||||||
|
}
|
||||||
|
|
||||||
cli.Init()
|
cli.Init()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue