pull/131/merge
Andrew Sayers 2025-01-02 14:57:14 +00:00 committed by GitHub
commit dc024ebdbd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 17 additions and 2 deletions

View File

@ -369,9 +369,24 @@ int ntfs_log_handler_syslog(const char *function __attribute__((unused)),
if ((level & NTFS_LOG_LEVEL_PERROR) && errno == ENOSPC) if ((level & NTFS_LOG_LEVEL_PERROR) && errno == ENOSPC)
return 1; return 1;
#endif #endif
int priority;
if ( level <= NTFS_LOG_LEVEL_DEBUG ) {
priority = LOG_DEBUG;
} else if ( level <= NTFS_LOG_LEVEL_INFO ) {
priority = LOG_INFO;
} else if ( level <= NTFS_LOG_LEVEL_WARNING ) {
priority = LOG_NOTICE;
} else if ( level <= NTFS_LOG_LEVEL_ERROR ) {
priority = LOG_ERR;
} else if ( level <= NTFS_LOG_LEVEL_CRITICAL ) {
priority = LOG_CRIT;
} else {
priority = LOG_ALERT;
}
ret = vsnprintf(logbuf, LOG_LINE_LEN, format, args); ret = vsnprintf(logbuf, LOG_LINE_LEN, format, args);
if (ret < 0) { if (ret < 0) {
vsyslog(LOG_NOTICE, format, args); vsyslog(priority, format, args);
ret = 1; ret = 1;
goto out; goto out;
} }
@ -382,7 +397,7 @@ int ntfs_log_handler_syslog(const char *function __attribute__((unused)),
ret = strlen(logbuf); ret = strlen(logbuf);
} }
syslog(LOG_NOTICE, "%s", logbuf); syslog(priority, "%s", logbuf);
out: out:
errno = olderr; errno = olderr;
return ret; return ret;