I'd like to propose a new contrib module, pg_stat_log, to track cumulative statistics about server log messages. Patch attached.
+1 I like this idea. I believe Nikolay Samokhvalov is going to run/check the performance impact.
The name... maybe it would be more clear as: pg_stat_log_elevel (clarifies the abstract "log" a bit better). Even pg_stat_server_log might be better. Just my opinion, "log" feels too lonely/generic.