Hacker News new | ask | show | jobs
by Izkata 562 days ago
> In fact, I'm going to build a toy one in python!

I suggest building it as a normal python logging handler instead of totally custom, that way you don't need a "text" toggle and it can be used without changing any existing standard python logging code. Only requires one tweak to the idea: Rather than a template table at the start of the file, have two types of log entries and add each template the first time it's used.

Drawback is having to parse the whole file to find all the templates, but you could also do something like putting the templates into a separate file to avoid that...