I have a signal handler in my program that looks like this:
void signalHandler(int sig)
{
BOOST_LOG_SEV(logger, fatal) << "Received signal " << sig;
gQuit = true;
}
Currently this produces output like this:
Received signal 2
But what I would like to see is something like
Received signal SIGINT
I could probably replace the output of sig
with strsignal(sig)
, which should work on POSIX.1-2008 systems. This solution was discussed in this SO question:
However, in my case I'd like to avoid the introduction of platform-specific code.
Do boost
or the Standard Library provide a solution to this problem?