Move ProgrammingError from logging.h to alloc.h

May be moved to something more specific, but the important part is that it's
in libutils, so Writer can be moved over.