logs: add option to list logging entries

Remembering the busctl commands is a bit onerous so provide a wrapper
to quickly see the logging entries in the system

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",
		]
	]
}

Signed-off-by: Andrew Geissler <geissonator@yahoo.com>
Change-Id: Ib1e4bb45c20ea487b64b59a8b440f35e0732ce72
diff --git a/obmcutil b/obmcutil
index 788170e..1741d9d 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"
+bmcrebootoff, bmcrebooton, listbootblock listlogs"
 
 USAGE="Usage: obmcutil [-h] [--wait] [--verbose]
                 {$OPTS}"
@@ -63,6 +63,9 @@
     echo "obmcutil listbootblock Check for and list any errors blocking the boot"
     echo "                       of the system"
     echo ""
+    echo "obmcutil listlogs      List all phosphor-logging entries on the"
+    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"
@@ -236,6 +239,18 @@
     fi
 }
 
+# list all phosphor-logging entries
+list_logs()
+{
+    # Look for any objects under logging that implement the
+    # xyz.openbmc_project.Logging.Entry
+    busctl -j call xyz.openbmc_project.ObjectMapper \
+            /xyz/openbmc_project/object_mapper \
+            xyz.openbmc_project.ObjectMapper \
+            GetSubTreePaths sias "/xyz/openbmc_project/logging/" 0 1 \
+            xyz.openbmc_project.Logging.Entry
+}
+
 handle_cmd ()
 {
     case "$1" in
@@ -383,6 +398,9 @@
                 echo "$blockingErrors"
             fi
             ;;
+        listlogs)
+            list_logs
+            ;;
         *)
             print_usage_err "Invalid command '$1'"
             ;;