LogHandler
Qt message handler for formatted log output + crash signal handler.
| Declared in | src/libs/liblog/log/LogHandler.hpp |
| Group | log |
Detailed description
LogHandler provides a custom Qt message handler that formats log messages with timestamp, severity, file, line, and function information. It also installs an async-signal-safe crash handler that survives heap corruption: see architecture §WD-CRASH in content/doc/internal/specs/audio-recovery-watchdog/.
The line format is fixed by diagnostic-reports §DGC-1a, because the report server groups lines across reports by their call site:
<S>: [<yyyy-MM-ddTHH:mm:ss.zzzZ>] <exe> - <category> - @<file>:<line> - <function> - <message>
Every line goes to stderr. Once attachFileSink() names the run's log file, every line also goes to that file, through a LogStorage run file (diagnostic-reports §DGC-1). Lines logged before the file is attached wait in memory and go to the file first.
See also LogStorage.
Member function documentation
LogHandler
LogHandler::LogHandler()
`<link.h>` is NOT one of the headers bionic lacks.
It sat in this block with `execinfo.h` and `ucontext.h`, and the grouping was wrong in a way that only an Android build could show: bionic has no `backtrace()`, so `execinfo.h` genuinely has to go — but it has provided `dl_iterate_phdr` and `struct dl_phdr_info` since API 21, and this file targets 28. The crash-context capture below sits under `#ifndef Q_OS_WIN`, which INCLUDES Android, so the code was compiled there with its header excluded: "member access into incomplete type 'struct dl_phdr_info'".
Found the first time anything built this tree for Android after the load bias capture landed.