1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-06 04:31:29 +00:00

Abstract nsock logging function to avoid nsock.h inclusion in output.h

This commit is contained in:
dmiller
2020-01-11 16:03:28 +00:00
parent 6ed754b438
commit a2c75e0ef4
6 changed files with 11 additions and 7 deletions

View File

@@ -151,6 +151,7 @@
#include "xml.h"
#include "nbase.h"
#include "libnetutil/netutil.h"
#include <nsock.h>
#include <math.h>
@@ -2782,7 +2783,7 @@ void nmap_adjust_loglevel(bool trace) {
nsock_set_loglevel(nsock_loglevel);
}
void nmap_nsock_stderr_logger(const struct nsock_log_rec *rec) {
static void nmap_nsock_stderr_logger(const struct nsock_log_rec *rec) {
int elapsed_time;
elapsed_time = TIMEVAL_MSEC_SUBTRACT(rec->time, *(o.getStartTime()));
@@ -2790,3 +2791,7 @@ void nmap_nsock_stderr_logger(const struct nsock_log_rec *rec) {
log_write(LOG_STDERR, "NSOCK %s [%.4fs] %s(): %s\n", nslog2str(rec->level),
elapsed_time/1000.0, rec->func, rec->msg);
}
void nmap_set_nsock_logger() {
nsock_set_log_function(nmap_nsock_stderr_logger);
}