Yep. The "style" of logger is in C, and looks (roughly) like this:
Logger* OpenLog(char*);
Table* MakeLog(Logger*, unsigned level, unsigned N, char* colNames, ColType *colTypes);
LOG(Table, Level, ...);
The branch to select log-level is trivial compared to the append cost. There's a few "backends" built in to the API: (1) a text-streaming version that just writes a text log; (2) a "bucketing" version that boils the calls to `MakeLog` down to accumulating buckets (with optional stack tracing); and, (3) journaling to a SQLite DB (with optional stack tracing).
Anyways, would love to hear more about your clever queries, even if it's OT.