The escaping should be done when outputting (in case someone is going to use the same routines to parse logs in code). (same for the label).