diff --git a/include/osquery/logger.h b/include/osquery/logger.h index 4d2b8e76..6a6c2021 100644 --- a/include/osquery/logger.h +++ b/include/osquery/logger.h @@ -48,6 +48,25 @@ struct StatusLogLine { std::string message; }; +/** + * @brief Helper logging macro for table-generated verbose log lines. + * + * Since logging in tables does not always mean a critical warning or error + * but more likely a parsing or expected edge-case, we provide a TLOG. + * + * The tool user can set within config or via the CLI what level of logging + * to tolerate. It's the table developer's job to assume consistency in logging. + */ +#define TLOG VLOG(1) + +/** + * @brief Prepend a reference number to the log line. + * + * A reference number is an external-search helper for somewhat confusing or + * seeminly-critical log lines. + */ +#define RLOG(n) "[Ref #" #n "] " + /** * @brief Superclass for the pluggable logging facilities. * diff --git a/osquery/events/darwin/iokit_hid.cpp b/osquery/events/darwin/iokit_hid.cpp index 35a3ef57..61a89b23 100644 --- a/osquery/events/darwin/iokit_hid.cpp +++ b/osquery/events/darwin/iokit_hid.cpp @@ -56,7 +56,7 @@ void IOKitHIDEventPublisher::restart() { auto status = IOHIDManagerOpen(manager_, kIOHIDOptionsTypeNone); if (status != kIOReturnSuccess) { - LOG(WARNING) << "[Reference #617] Cannot open IOKit HID Manager"; + LOG(WARNING) << RLOG(617) << "Cannot open IOKit HID Manager"; return; }