in newtmgr/cli/log.go [348:411]
func logCmd() *cobra.Command {
logCmd := &cobra.Command{
Use: "log",
Short: "Manage logs on a device",
Run: func(cmd *cobra.Command, args []string) {
cmd.HelpFunc()(cmd, args)
},
}
logShowHelpText := "Show logs on a device. Optional log-name, min-index, and min-timestamp\nparameters can be specified to filter the logs to display.\n\n"
logShowHelpText += "- log-name specifies the log to display. If log-name is not specified, all\nlogs are displayed.\n\n"
logShowHelpText += "- min-index specifies to only display the log entries with an index value equal to or higher than min-index. "
logShowHelpText += "If \"last\" is specified for min-index, the last\nlog entry is displayed.\n\n"
logShowHelpText += "- min-timestamp specifies to only display the log entries with a timestamp\nequal to or later than min-timestamp. Log entries with a timestamp equal to\nmin-timestamp are only displayed if the entry index is equal to or higher than min-index.\n"
logShowEx := nmutil.ToolInfo.ExeName + " log show -c myserial\n"
logShowEx += nmutil.ToolInfo.ExeName + " log show reboot_log -c myserial\n"
logShowEx += nmutil.ToolInfo.ExeName + " log show reboot_log last -c myserial\n"
logShowEx += nmutil.ToolInfo.ExeName + " log show reboot_log 5 -c myserial\n"
logShowEx += nmutil.ToolInfo.ExeName + " log show reboot_log 3 1122222 -c myserial\n"
showCmd := &cobra.Command{
Use: "show [log-name [min-index [min-timestamp]]] -c <conn_profile>",
Example: logShowEx,
Long: logShowHelpText,
Short: "Show the logs on a device",
Run: logShowCmd,
}
showCmd.PersistentFlags().BoolVarP(&optLogShowFull, "all", "a", false, "read until end of log")
logCmd.AddCommand(showCmd)
clearCmd := &cobra.Command{
Use: "clear -c <conn_profile>",
Short: "Clear the logs on a device",
Example: logShowEx,
Run: logClearCmd,
}
logCmd.AddCommand(clearCmd)
moduleListCmd := &cobra.Command{
Use: "module_list -c <conn_profile>",
Short: "Show the log module names",
Run: logModuleListCmd,
}
logCmd.AddCommand(moduleListCmd)
levelListCmd := &cobra.Command{
Use: "level_list -c <conn_profile>",
Short: "Show the log levels",
Run: logLevelListCmd,
}
logCmd.AddCommand(levelListCmd)
ListCmd := &cobra.Command{
Use: "list -c <conn_profile>",
Short: "Show the log names",
Run: logListCmd,
}
logCmd.AddCommand(ListCmd)
return logCmd
}