From 9fc92e8da81e1ed8af710b5648b3057fce9b19cb Mon Sep 17 00:00:00 2001 From: Liam Stanley Date: Tue, 18 Apr 2017 04:59:51 -0400 Subject: [PATCH] extra stack info to handler registration and exec --- handler.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/handler.go b/handler.go index 7f9350d..72cb611 100644 --- a/handler.go +++ b/handler.go @@ -190,7 +190,7 @@ func (c *Caller) exec(command string, client *Client, event *Event) { c.wg.Add(len(stack)) for i := 0; i < len(stack); i++ { go func(index int) { - c.debug.Printf("executing handler %s for event %s", stack[index].cuid, command) + c.debug.Printf("executing handler %s for event %s (%d of %d)", stack[index].cuid, command, index+1, len(stack)) start := time.Now() // If they want to catch any panics, add to defer stack. @@ -200,7 +200,7 @@ func (c *Caller) exec(command string, client *Client, event *Event) { stack[index].Execute(client, *event) - c.debug.Printf("execution of %s took %s", stack[index].cuid, time.Since(start)) + c.debug.Printf("execution of %s took %s (%d of %d)", stack[index].cuid, time.Since(start), index+1, len(stack)) c.wg.Done() }(i) } @@ -313,7 +313,9 @@ func (c *Caller) register(internal bool, cmd string, handler Handler) (cuid stri c.external[cmd][uid] = handler } - c.debug.Printf("registering handler for %q with cuid %q (internal: %t)", cmd, cuid, internal) + _, file, line, _ := runtime.Caller(3) + + c.debug.Printf("registering handler for %q with cuid %q (internal: %t) from: %s:%d", cmd, cuid, internal, file, line) return cuid }