Dwm::SysLogger class definition and Syslog() macro. More...
#include <errno.h>#include <stdarg.h>#include <syslog.h>#include <cstdio>#include <version>#include <mutex>#include <source_location>#include <string>#include "DwmPortability.hh"#include <format>

Go to the source code of this file.
Classes | |
| class | Dwm::SysLogger |
| This class encapsulates syslog logging in global scope (all members are static). More... | |
Macros | |
| #define | Syslog(...) Dwm::SysLogger::Log(std::source_location::current(),__VA_ARGS__) |
| Used just like syslog(), but calls Dwm::SysLogger::Log() to allow the filename, line number and function name to be logged automatically and the priority tag text provided by Dwm::SysLogger. | |
| #define | FSyslog(...) Dwm::SysLogger::FmtLog(std::source_location::current(),__VA_ARGS__) |
| Like Syslog() but the format string (second argument) is a std::format format string. | |
Dwm::SysLogger class definition and Syslog() macro.
| #define FSyslog | ( | ... | ) | Dwm::SysLogger::FmtLog(std::source_location::current(),__VA_ARGS__) |
Like Syslog() but the format string (second argument) is a std::format format string.
Unfortunately some of the popular Linux distributions are way behind on a libstdc++ that has <format>. It's May 26, 2024 and Ubuntu 24.04 and Raspberry Pi 12 (bookwork) don't have the C++20 features that are needed. On such platforms, I use libfmt instead.
| #define Syslog | ( | ... | ) | Dwm::SysLogger::Log(std::source_location::current(),__VA_ARGS__) |
Used just like syslog(), but calls Dwm::SysLogger::Log() to allow the filename, line number and function name to be logged automatically and the priority tag text provided by Dwm::SysLogger.
Note this requires variadic macros, but g++ and clang++ support them.