logs: provide option to delete all logs

Tested:
root@witherspoon:~# obmcutil listlogs
{
	"type" : "as",
	"data" : [
		[
			"/xyz/openbmc_project/logging/entry/1",
			"/xyz/openbmc_project/logging/entry/2",
			"/xyz/openbmc_project/logging/entry/3",
			"/xyz/openbmc_project/logging/entry/4",
		]
	]
}
root@witherspoon:~# obmcutil deletelogs
root@witherspoon:~# obmcutil listlogs
{
	"type" : "as",
	"data" : [
		[]
	]
}

Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: Ifd9b0222515bf95d831e09cbf91784452cbd1b7e
diff --git a/obmcutil b/obmcutil
index 016cfa2..788a55f 100755
--- a/obmcutil
+++ b/obmcutil
@@ -4,7 +4,7 @@
 
 OPTS="bmcstate,bootprogress,chassiskill,chassisoff,chassison,chassisstate,hoststate,\
 osstate,power,poweroff,poweron,state,status,hostrebootoff,hostrebooton,recoveryoff,recoveryon,\
-bmcrebootoff, bmcrebooton, listbootblock listlogs showlog"
+bmcrebootoff, bmcrebooton, listbootblock listlogs showlog deletelogs"
 
 USAGE="Usage: obmcutil [-h] [--wait] [--verbose]
                 {$OPTS}"
@@ -69,6 +69,9 @@
     echo "obmcutil showlog <log> Display details of input log. Format of <log>"
     echo "                       should match listlogs output"
     echo ""
+    echo "obmcutil deletelogs    Delete all phosphor-logging entries from"
+    echo "                       system"
+    echo ""
     echo "optional arguments:"
     echo "  -h, --help          show this help message and exit"
     echo "  -w, --wait          block until state transition succeeds or fails"
@@ -263,6 +266,14 @@
            GetAll s xyz.openbmc_project.Logging.Entry
 }
 
+# delete all phosphor-logging entries
+delete_logs()
+{
+    busctl call xyz.openbmc_project.Logging \
+           /xyz/openbmc_project/logging \
+           xyz.openbmc_project.Collection.DeleteAll DeleteAll
+}
+
 handle_cmd ()
 {
     case "$1" in
@@ -416,6 +427,9 @@
         showlog)
             show_log $2
             ;;
+        deletelogs)
+            delete_logs
+            ;;
         *)
             print_usage_err "Invalid command '$1'"
             ;;