MYNEWT-677 NMP: Include next_index in log show rsp The next_index value (index of next log entry to be written) is useful for determining if a device's flash has been wiped since the last time logs were scoured.
The new value is at the top-level of the log show response with the following name: next_index. Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/commit/f58e088a Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/tree/f58e088a Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/diff/f58e088a Branch: refs/heads/master Commit: f58e088afe150825556f0d7c47020c4490ea9dba Parents: 02401c9 Author: Christopher Collins <[email protected]> Authored: Fri Mar 17 12:50:47 2017 -0700 Committer: Christopher Collins <[email protected]> Committed: Tue Mar 28 15:38:36 2017 -0700 ---------------------------------------------------------------------- newtmgr/cli/log.go | 1 + newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/log.go | 5 +++-- nmxact/nmp/log.go | 5 +++-- 3 files changed, 7 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/f58e088a/newtmgr/cli/log.go ---------------------------------------------------------------------- diff --git a/newtmgr/cli/log.go b/newtmgr/cli/log.go index c6658a8..cba1e5b 100644 --- a/newtmgr/cli/log.go +++ b/newtmgr/cli/log.go @@ -74,6 +74,7 @@ func logShowCmd(cmd *cobra.Command, args []string) { sres := res.(*xact.LogShowResult) fmt.Printf("Status: %d\n", sres.Status()) + fmt.Printf("Next index: %d\n", sres.Rsp.NextIndex) if len(sres.Rsp.Logs) == 0 { fmt.Printf("(no logs retrieved)\n") return http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/f58e088a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/log.go ---------------------------------------------------------------------- diff --git a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/log.go b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/log.go index 3b3eff5..e03376f 100644 --- a/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/log.go +++ b/newtmgr/vendor/mynewt.apache.org/newt/nmxact/nmp/log.go @@ -129,8 +129,9 @@ type LogShowLog struct { type LogShowRsp struct { NmpBase - Rc int `codec:"rc" codec:",omitempty"` - Logs []LogShowLog `codec:"logs"` + Rc int `codec:"rc" codec:",omitempty"` + NextIndex uint32 `codec:"next_index"` + Logs []LogShowLog `codec:"logs"` } func NewLogShowReq() *LogShowReq { http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newtmgr/blob/f58e088a/nmxact/nmp/log.go ---------------------------------------------------------------------- diff --git a/nmxact/nmp/log.go b/nmxact/nmp/log.go index 3b3eff5..e03376f 100644 --- a/nmxact/nmp/log.go +++ b/nmxact/nmp/log.go @@ -129,8 +129,9 @@ type LogShowLog struct { type LogShowRsp struct { NmpBase - Rc int `codec:"rc" codec:",omitempty"` - Logs []LogShowLog `codec:"logs"` + Rc int `codec:"rc" codec:",omitempty"` + NextIndex uint32 `codec:"next_index"` + Logs []LogShowLog `codec:"logs"` } func NewLogShowReq() *LogShowReq {
