Format string with character not controlled by the application is universally bad. I think it is more reasonable to vsnprintf the application-supplied information to a fixed sized buffer, and printf the result with the user-supplied argv[0] with a fixed fmt. This limits the length of the output to the buffer size, but that is probably good for a log file anyway. The double-copy speed overhead is probably irrelevant.