From a9835c1816bc49ee54c82b4f2a5b05cbcd89881b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kurk=C3=B3=20Mih=C3=A1ly?= Date: Wed, 11 Jul 2018 10:59:04 +0300 Subject: cmd, dashboard, log: log collection and exploration (#17097) * cmd, dashboard, internal, log, node: logging feature * cmd, dashboard, internal, log: requested changes * dashboard, vendor: gofmt, govendor, use vendored file watcher * dashboard, log: gofmt -s -w, goimports * dashboard, log: gosimple --- dashboard/message.go | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'dashboard/message.go') diff --git a/dashboard/message.go b/dashboard/message.go index 84b8d7443..46856b9e6 100644 --- a/dashboard/message.go +++ b/dashboard/message.go @@ -16,7 +16,10 @@ package dashboard -import "time" +import ( + "encoding/json" + "time" +) type Message struct { General *GeneralMessage `json:"general,omitempty"` @@ -67,6 +70,24 @@ type SystemMessage struct { DiskWrite ChartEntries `json:"diskWrite,omitempty"` } +// LogsMessage wraps up a log chunk. If Source isn't present, the chunk is a stream chunk. type LogsMessage struct { - Log []string `json:"log,omitempty"` + Source *LogFile `json:"source,omitempty"` // Attributes of the log file. + Chunk json.RawMessage `json:"chunk"` // Contains log records. +} + +// LogFile contains the attributes of a log file. +type LogFile struct { + Name string `json:"name"` // The name of the file. + Last bool `json:"last"` // Denotes if the actual log file is the last one in the directory. +} + +// Request represents the client request. +type Request struct { + Logs *LogsRequest `json:"logs,omitempty"` +} + +type LogsRequest struct { + Name string `json:"name"` // The request handler searches for log file based on this file name. + Past bool `json:"past"` // Denotes whether the client wants the previous or the next file. } -- cgit v1.2.3