aboutsummaryrefslogtreecommitdiff
path: root/routers/debug
diff options
context:
space:
mode:
author无闻 <joe2010xtmf@163.com>2014-07-04 14:28:46 -0400
committer无闻 <joe2010xtmf@163.com>2014-07-04 14:28:46 -0400
commitae7f3eed78bf79eb3dfd49d4a2837fe4913ef89c (patch)
tree6fbedb5f9e385379c0f82023991564b4b16d57d2 /routers/debug
parent0820b24f0bea6a0ce2f9c035a581bcf829ad0e13 (diff)
parenta481672c5cec1efe8d4856b393e98775c55ad8bc (diff)
Merge pull request #272 from nuss-justin/dev
Add 'pprof' tag for enabling debugging
Diffstat (limited to 'routers/debug')
-rw-r--r--routers/debug/debug.go16
-rw-r--r--routers/debug/ignored.go11
2 files changed, 27 insertions, 0 deletions
diff --git a/routers/debug/debug.go b/routers/debug/debug.go
new file mode 100644
index 00000000..c332dbea
--- /dev/null
+++ b/routers/debug/debug.go
@@ -0,0 +1,16 @@
+// +build pprof
+
+package debug
+
+import (
+ "net/http/pprof"
+
+ "github.com/go-martini/martini"
+)
+
+func RegisterRoutes(r martini.Router) {
+ r.Get("/debug/pprof/cmdline", pprof.Cmdline)
+ r.Get("/debug/pprof/profile", pprof.Profile)
+ r.Get("/debug/pprof/symbol", pprof.Symbol)
+ r.Get("/debug/pprof/**", pprof.Index)
+}
diff --git a/routers/debug/ignored.go b/routers/debug/ignored.go
new file mode 100644
index 00000000..4ec49964
--- /dev/null
+++ b/routers/debug/ignored.go
@@ -0,0 +1,11 @@
+// +build !pprof
+
+package debug
+
+import (
+ "github.com/go-martini/martini"
+)
+
+func RegisterRoutes(r martini.Router) {
+ // do nothing
+}