mirror of
https://github.com/minio/minio.git
synced 2025-02-03 09:55:59 -05:00
commit
9b2cff14bb
4
main.go
4
main.go
@ -25,6 +25,7 @@ import (
|
|||||||
|
|
||||||
"github.com/dustin/go-humanize"
|
"github.com/dustin/go-humanize"
|
||||||
"github.com/minio/cli"
|
"github.com/minio/cli"
|
||||||
|
"github.com/minio/minio-xl/pkg/probe"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -147,6 +148,9 @@ VERSION:
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
// Set projet's root source path.
|
||||||
|
probe.SetRoot()
|
||||||
|
|
||||||
app := registerApp()
|
app := registerApp()
|
||||||
app.Before = func(c *cli.Context) error {
|
app.Before = func(c *cli.Context) error {
|
||||||
globalJSONFlag = c.GlobalBool("json")
|
globalJSONFlag = c.GlobalBool("json")
|
||||||
|
15
vendor/github.com/minio/minio-xl/pkg/probe/probe.go
generated
vendored
15
vendor/github.com/minio/minio-xl/pkg/probe/probe.go
generated
vendored
@ -29,6 +29,19 @@ import (
|
|||||||
"github.com/dustin/go-humanize"
|
"github.com/dustin/go-humanize"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
// Root path to the project's source.
|
||||||
|
var rootPath string
|
||||||
|
|
||||||
|
// SetRoot sets the project's root path. Root path is automatically
|
||||||
|
// determined from the calling function's source file location. It is
|
||||||
|
// typically called from the main() function.
|
||||||
|
func SetRoot() {
|
||||||
|
// Catch the calling function's source file path.
|
||||||
|
_, file, _, _ := runtime.Caller(1)
|
||||||
|
// Save the directory alone.
|
||||||
|
rootPath = filepath.Dir(file)
|
||||||
|
}
|
||||||
|
|
||||||
// GetSysInfo returns useful system statistics.
|
// GetSysInfo returns useful system statistics.
|
||||||
func GetSysInfo() map[string]string {
|
func GetSysInfo() map[string]string {
|
||||||
host, err := os.Hostname()
|
host, err := os.Hostname()
|
||||||
@ -113,7 +126,7 @@ func (e *Error) trace(fields ...string) *Error {
|
|||||||
pc, file, line, _ := runtime.Caller(2)
|
pc, file, line, _ := runtime.Caller(2)
|
||||||
function := runtime.FuncForPC(pc).Name()
|
function := runtime.FuncForPC(pc).Name()
|
||||||
_, function = filepath.Split(function)
|
_, function = filepath.Split(function)
|
||||||
file = "..." + strings.TrimPrefix(file, os.Getenv("GOPATH")) // trim gopathSource from file
|
file = strings.TrimPrefix(file, rootPath+string(os.PathSeparator)) // trims project's root path.
|
||||||
tp := TracePoint{}
|
tp := TracePoint{}
|
||||||
if len(fields) > 0 {
|
if len(fields) > 0 {
|
||||||
tp = TracePoint{Line: line, Filename: file, Function: function, Env: map[string][]string{"Tags": fields}}
|
tp = TracePoint{Line: line, Filename: file, Function: function, Env: map[string][]string{"Tags": fields}}
|
||||||
|
2
vendor/github.com/minio/minio-xl/pkg/probe/probe_test.go
generated
vendored
2
vendor/github.com/minio/minio-xl/pkg/probe/probe_test.go
generated
vendored
@ -43,6 +43,8 @@ func testDummy2() *probe.Error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *MySuite) TestProbe(c *C) {
|
func (s *MySuite) TestProbe(c *C) {
|
||||||
|
probe.SetRoot() // Set project's root source path.
|
||||||
|
|
||||||
es := testDummy2().Trace("TopOfStack")
|
es := testDummy2().Trace("TopOfStack")
|
||||||
// Uncomment the following Println to visually test probe call trace.
|
// Uncomment the following Println to visually test probe call trace.
|
||||||
// fmt.Println("Expecting a simulated error here.", es)
|
// fmt.Println("Expecting a simulated error here.", es)
|
||||||
|
4
vendor/vendor.json
vendored
4
vendor/vendor.json
vendored
@ -64,8 +64,8 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "github.com/minio/minio-xl/pkg/probe",
|
"path": "github.com/minio/minio-xl/pkg/probe",
|
||||||
"revision": "a5fc6d2430ba2ebcab31b938ab02a42bac85dc2e",
|
"revision": "0ccfa2965bc93efde3efda8b0f0779690f192d4f",
|
||||||
"revisionTime": "2015-10-20T11:16:42-07:00"
|
"revisionTime": "2015-10-23T19:31:44-07:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"path": "github.com/minio/minio-xl/pkg/quick",
|
"path": "github.com/minio/minio-xl/pkg/quick",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user