From 1283484fb8f6a4531219984cf4d8d54e14a2ad05 Mon Sep 17 00:00:00 2001 From: Kevin Webb Date: Wed, 19 Nov 2008 23:41:59 +0000 Subject: [PATCH] Smarter logging - once again. Ready to run it for real now. Fingers crossed... --- drl/estimate.c | 8 ++++---- drl/logging.c | 4 ++-- drl/standard.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drl/estimate.c b/drl/estimate.c index 29704be..80560ea 100644 --- a/drl/estimate.c +++ b/drl/estimate.c @@ -105,8 +105,8 @@ static double allocate_fps_over_limit(identity_t *ident) { if (ident->common.max_flow_rate > 0) { ideal_weight = (double) ident->locallimit / (double) ident->common.max_flow_rate; - printlog(LOG_DEBUG, "%.3f %d %d FlowCount, TotalRate, MaxRate\n", - ideal_weight, ident->common.rate, ident->common.max_flow_rate); + printlog(LOG_DEBUG, "%.3f %d %d %d FlowCount, Limit, MaxRate, TotalRate\n", + ideal_weight, ident->locallimit, ident->common.max_flow_rate, ident->common.rate); } else { ideal_weight = 1; } @@ -122,7 +122,7 @@ static uint32_t allocate_fps(identity_t *ident, double total_weight) { common_accounting_t *ftable = &ident->common; /* Common flow table info */ uint32_t local_rate = ftable->rate; uint32_t ideallocal = 0; - double peer_weights; /* sum of weights of all other limiters */ + double peer_weights; /* sum of weights of all other limiters */ double idealweight = 0; double last_portion = 0; double this_portion = 0; @@ -237,7 +237,7 @@ static uint32_t allocate_fps(identity_t *ident, double total_weight) { } if (printcounter <= 0) { - printlog(LOG_WARN, "%d %.1f %.1f %.1f %d %d %d %d %d %d ", local_rate, idealweight, + printlog(LOG_WARN, "%d %.2f %.2f %.2f %d %d %d %d %d %d ", local_rate, idealweight, ident->localweight, total_weight, ftable->num_flows, ftable->num_flows_5k, ftable->num_flows_10k, ftable->num_flows_20k, ftable->num_flows_50k, ftable->avg_rate); printcounter = PRINT_COUNTER_RESET; diff --git a/drl/logging.c b/drl/logging.c index ca3d7c1..23a6f59 100644 --- a/drl/logging.c +++ b/drl/logging.c @@ -7,9 +7,9 @@ FILE *logfile; uint8_t system_loglevel; inline void printlog(const uint8_t level, const char *format, ...) { - va_list args; - if (system_loglevel <= level) { + va_list args; + va_start(args, format); vfprintf(logfile, format, args); va_end(args); diff --git a/drl/standard.c b/drl/standard.c index 5b9632e..5c6a6d8 100644 --- a/drl/standard.c +++ b/drl/standard.c @@ -106,7 +106,7 @@ standard_flow *standard_table_lookup(standard_flow_table table, const key_flow * dst.s_addr = ntohl(flow->dest_ip); strcpy(sip, inet_ntoa(src)); strcpy(dip, inet_ntoa(dst)); - printlog(LOG_DEBUG, "ALLOC:%s:%hd -> %s:%hd\n", sip, + printlog(LOG_DEBUG, "ALLOC:%s:%hu -> %s:%hu\n", sip, flow->source_port, dip, flow->dest_port); } -- 2.43.0