Have the error library have an internal flag for this, which defaults false, but which can be reset.
When the GUI application starts, have it set the flag.
Yeah, yeah, it is a global. So are environment variables. And some day you may have your application called from a process that inherited an environment from an unrelated GUI. (But you are backgrounded.)
Globals which are shared across processes are worse than globals inside of processes...
Cheers,
Ben