Embed DebugHandler proto
This commit is contained in:
parent
60e0e81523
commit
265e8ade05
@ -17,6 +17,7 @@ var (
|
|||||||
|
|
||||||
type Debug struct {
|
type Debug struct {
|
||||||
started int64
|
started int64
|
||||||
|
proto.DebugHandler
|
||||||
log.Log
|
log.Log
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +56,6 @@ func (d *Debug) Logs(ctx context.Context, req *proto.LogRequest, stream proto.De
|
|||||||
defer stream.Close()
|
defer stream.Close()
|
||||||
|
|
||||||
// TODO: figure out the stream later on
|
// TODO: figure out the stream later on
|
||||||
// stream the logs
|
|
||||||
for _, record := range records {
|
for _, record := range records {
|
||||||
metadata := make(map[string]string)
|
metadata := make(map[string]string)
|
||||||
for k, v := range record.Metadata {
|
for k, v := range record.Metadata {
|
||||||
|
@ -32,13 +32,13 @@ func NewLog(opts ...Option) Log {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Write writes log into logger
|
// Write writes logs into logger
|
||||||
func (l *defaultLog) Write(v ...interface{}) {
|
func (l *defaultLog) Write(v ...interface{}) {
|
||||||
l.Buffer.Put(fmt.Sprint(v...))
|
l.Buffer.Put(fmt.Sprint(v...))
|
||||||
golog.Print(v...)
|
golog.Print(v...)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Read reads logs from the logger
|
// Read reads logs and returns them
|
||||||
func (l *defaultLog) Read(opts ...ReadOption) []Record {
|
func (l *defaultLog) Read(opts ...ReadOption) []Record {
|
||||||
options := ReadOptions{}
|
options := ReadOptions{}
|
||||||
// initialize the read options
|
// initialize the read options
|
||||||
@ -55,8 +55,9 @@ func (l *defaultLog) Read(opts ...ReadOption) []Record {
|
|||||||
entries = l.Buffer.Get(options.Count)
|
entries = l.Buffer.Get(options.Count)
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: if both Since and Count are set should we return
|
// TODO: if both Since and Count are set should we return?
|
||||||
// last Count from the returned time scoped entries?
|
// last Count from the returned time scoped entries?
|
||||||
|
|
||||||
records := make([]Record, 0, len(entries))
|
records := make([]Record, 0, len(entries))
|
||||||
for _, entry := range entries {
|
for _, entry := range entries {
|
||||||
record := Record{
|
record := Record{
|
||||||
|
Loading…
Reference in New Issue
Block a user