KernelLogger: Update printk buffer size

The buffer size isn't 1024, it's actually 1024-48 or 1024-32, depending
on CONFIG_PRINTK_CALLER is defined or not.
Since we don't know the kernel config at build time, we should assume
the smallest possible size, which is 1024 - 48.

Reference: kernel/printk/printk.c

Test: Manually add code that uses the kernel logger and observe dmesg
Change-Id: I5e54c9345f831de1c21de46e0f1cdbee15d0447b
diff --git a/logging.cpp b/logging.cpp
index 54f3fcc..81269dd 100644
--- a/logging.cpp
+++ b/logging.cpp
@@ -255,10 +255,13 @@
 
   int level = kLogSeverityToKernelLogLevel[severity];
 
-  // The kernel's printk buffer is only 1024 bytes.
+  // The kernel's printk buffer is only |1024 - PREFIX_MAX| bytes, where
+  // PREFIX_MAX could be 48 or 32.
+  // Reference: kernel/printk/printk.c
   // TODO: should we automatically break up long lines into multiple lines?
   // Or we could log but with something like "..." at the end?
-  char buf[1024] __attribute__((__uninitialized__));
+  static constexpr int LOG_LINE_MAX = 1024 - 48;
+  char buf[LOG_LINE_MAX] __attribute__((__uninitialized__));
   size_t size = snprintf(buf, sizeof(buf), "<%d>%s: %.*s\n", level, tag, length, msg);
   if (size > sizeof(buf)) {
     size = snprintf(buf, sizeof(buf), "<%d>%s: %zu-byte message too long for printk\n",