chiark / gitweb /
journalct: also print Python code in --new-id
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Mon, 11 Feb 2013 03:47:14 +0000 (22:47 -0500)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Fri, 22 Feb 2013 15:57:43 +0000 (16:57 +0100)
src/journal/journalctl.c

index 0afeef932e54b89f615cf91570b0d0c239240894..0de159b89a84b1dd9ab6caad8963d5d4fc74a2ec 100644 (file)
@@ -462,14 +462,17 @@ static int generate_new_id128(void) {
                "As UUID:\n"
                "%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\n\n"
                "As macro:\n"
-              "#define MESSAGE_XYZ SD_ID128_MAKE(",
+               "#define MESSAGE_XYZ SD_ID128_MAKE(",
                SD_ID128_FORMAT_VAL(id),
                SD_ID128_FORMAT_VAL(id));
-
         for (i = 0; i < 16; i++)
                 printf("%02x%s", id.bytes[i], i != 15 ? "," : "");
+        fputs(")\n\n", stdout);
 
-        fputs(")\n", stdout);
+        printf("As Python constant:\n"
+               ">>> import uuid\n"
+               ">>> MESSAGE_XYZ = uuid.UUID('" SD_ID128_FORMAT_STR "')\n",
+               SD_ID128_FORMAT_VAL(id));
 
         return 0;
 }