Embed logger into debug.Handler

This commit is contained in:
Milos Gajdos 2019-11-27 16:12:39 +00:00
parent ee9776e7b2
commit 9e177be560
No known key found for this signature in database
GPG Key ID: 8B31058CC55DFD4F
2 changed files with 9 additions and 1 deletions

View File

@ -5,6 +5,8 @@ import (
"runtime" "runtime"
"time" "time"
"github.com/micro/go-micro/debug/log"
proto "github.com/micro/go-micro/debug/proto" proto "github.com/micro/go-micro/debug/proto"
) )
@ -15,6 +17,7 @@ var (
type Debug struct { type Debug struct {
started int64 started int64
log.Logger
} }
func newDebug() *Debug { func newDebug() *Debug {

View File

@ -40,7 +40,12 @@ func (l *defaultLogger) Write(v ...interface{}) {
// Read reads logs from the logger // Read reads logs from the logger
func (l *defaultLogger) Read(n int) []interface{} { func (l *defaultLogger) Read(n int) []interface{} {
return l.Get(n) entries := l.Get(n)
vals := make([]interface{}, 0, len(entries))
for _, val := range entries {
vals = append(vals, val)
}
return vals
} }
func (l *defaultLogger) log(entry string) { func (l *defaultLogger) log(entry string) {