X-Git-Url: https://git.sesse.net/?p=cubemap;a=blobdiff_plain;f=log.cpp;fp=log.cpp;h=a4f923644a5b9597febecb038fa8c54c8526a207;hp=ba05a64d1fe5236c4dfe370a947254587c56cf37;hb=4856c49f1b63753ce86ad759ee649a1117628a8e;hpb=95ffb595e77280a7ce9e2412ce746565fb760020 diff --git a/log.cpp b/log.cpp index ba05a64..a4f9236 100644 --- a/log.cpp +++ b/log.cpp @@ -1,9 +1,11 @@ #include "log.h" #include +#include #include #include #include +#include #include #include @@ -110,3 +112,10 @@ void log(LogLevel log_level, const char *fmt, ...) } } } + +void log_perror(const char *msg) +{ + char errbuf[4096]; + strerror_r(errno, errbuf, sizeof(errbuf)); + log(ERROR, "%s: %s", msg, errbuf); +}