Logging in C with support for monoid logging