options/posix: implement setlogmask
@@ -60,9 +60,12 @@ void openlog(const char *ident, int options, int facility) {
__openlog();
}
-int setlogmask(int) {
- __ensure(!"Not implemented");
- __builtin_unreachable();
+int setlogmask(int mask) {
+ int old_mask = log_mask;
+
+ log_mask = mask;
+
+ return old_mask;
}
static void _vsyslog(int priority, const char *message, va_list ap) {
@@ -70,6 +73,10 @@ static void _vsyslog(int priority, const char *message, va_list ap) {
return e == ECONNREFUSED || e == ECONNRESET || e == ENOTCONN || e == EPIPE;
};
+ if(!(priority & log_mask)) {
+ return;
+ }
+
char timebuf[16];
time_t now;
struct tm tm;
