You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by vi...@apache.org on 2019/08/10 00:37:04 UTC
[mynewt-newtmgr] branch master updated: Include imghash in log show
output
This is an automated email from the ASF dual-hosted git repository.
vipulrahane pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-newtmgr.git
The following commit(s) were added to refs/heads/master by this push:
new 7c0b1c0 Include imghash in log show output
new 5d1446c Merge pull request #139 from ccollins476ad/imghash
7c0b1c0 is described below
commit 7c0b1c0500d4e583118ae38b90477ee1f3e1ae0f
Author: Christopher Collins <cc...@apache.org>
AuthorDate: Wed Aug 7 17:11:54 2019 -0700
Include imghash in log show output
The Mynewt log entry header optionally includes an "imghash" field.
This field contains a truncated hash of the build that was running when
the entry was logged. If an entry contains this hash, the Mynewt device
includes it in a `log show` response.
This commit changes newtmgr to print the image hash when it sees it in a
`log show` response.
---
newtmgr/cli/log.go | 10 ++++++----
nmxact/nmp/log.go | 1 +
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/newtmgr/cli/log.go b/newtmgr/cli/log.go
index 1977c8b..350ccff 100644
--- a/newtmgr/cli/log.go
+++ b/newtmgr/cli/log.go
@@ -107,9 +107,9 @@ func logShowCmd(cmd *cobra.Command, args []string) {
return
}
- fmt.Printf("%10s %22s | %16s %16s %6s %s\n",
+ fmt.Printf("%10s %22s | %16s %16s %6s %8s %s\n",
"[index]", "[timestamp]", "[module]", "[level]", "[type]",
- "[message]")
+ "[img]", "[message]")
for _, entry := range log.Entries {
modText := fmt.Sprintf("%s (%d)",
nmp.LogModuleToString(int(entry.Module)), entry.Module)
@@ -138,14 +138,15 @@ func logShowCmd(cmd *cobra.Command, args []string) {
int(entry.Type), entry.Index)
msgText = hex.EncodeToString(entry.Msg)
}
- fmt.Printf("%10d %20dus | %16s %16s %6s %s\n",
+
+ fmt.Printf("%10d %20dus | %16s %16s %6s %8s %s\n",
entry.Index,
entry.Timestamp,
modText,
levText,
entry.Type,
+ hex.EncodeToString(entry.ImgHash),
msgText)
-
}
}
}
@@ -327,5 +328,6 @@ func logCmd() *cobra.Command {
}
logCmd.AddCommand(ListCmd)
+
return logCmd
}
diff --git a/nmxact/nmp/log.go b/nmxact/nmp/log.go
index 3995206..4e34cc1 100644
--- a/nmxact/nmp/log.go
+++ b/nmxact/nmp/log.go
@@ -135,6 +135,7 @@ type LogEntry struct {
Module uint8 `codec:"module"`
Level uint8 `codec:"level"`
Type LogEntryType `codec:"type"`
+ ImgHash []byte `codec:"imghash"`
Msg []byte `codec:"msg"`
}