changeset 8669:14b9a90eb01d HEAD

quota debug: Hide "(0%)" if quota limits aren't defined defined in percentages.
author Timo Sirainen <tss@iki.fi>
date Wed, 21 Jan 2009 12:40:06 -0500
parents 1cea5aa6915c
children 85476be1fee2
files src/plugins/quota/quota.c
diffstat 1 files changed, 14 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/plugins/quota/quota.c	Wed Jan 21 12:30:15 2009 -0500
+++ b/src/plugins/quota/quota.c	Wed Jan 21 12:40:06 2009 -0500
@@ -422,10 +422,14 @@
 	quota_root_recalculate_relative_rules(root_set);
 	if (root_set->set->debug) {
 		i_info("Quota rule: root=%s mailbox=%s "
-		       "bytes=%lld (%u%%) messages=%lld (%u%%)", root_set->name,
+		       "bytes=%lld%s messages=%lld%s", root_set->name,
 		       mailbox_name,
-		       (long long)rule->bytes_limit, rule->bytes_percent,
-		       (long long)rule->count_limit, rule->count_percent);
+		       (long long)rule->bytes_limit,
+		       rule->bytes_percent == 0 ? "" :
+		       t_strdup_printf(" (%u%%)", rule->bytes_percent),
+		       (long long)rule->count_limit,
+		       rule->count_percent == 0 ? "" :
+		       t_strdup_printf(" (%u%%)", rule->count_percent));
 	}
 	return ret;
 }
@@ -570,12 +574,15 @@
 
 	quota_root_recalculate_relative_rules(root_set);
 	if (root_set->set->debug) {
-		i_info("Quota warning: bytes=%llu (%u%%) "
-		       "messages=%llu (%u%%) command=%s",
+		i_info("Quota warning: bytes=%llu%s "
+		       "messages=%llu%s command=%s",
 		       (unsigned long long)warning->rule.bytes_limit,
-		       warning->rule.bytes_percent,
+		       warning->rule.bytes_percent == 0 ? "" :
+		       t_strdup_printf(" (%u%%)", warning->rule.bytes_percent),
 		       (unsigned long long)warning->rule.count_limit,
-		       warning->rule.count_percent, warning->command);
+		       warning->rule.count_percent == 0 ? "" :
+		       t_strdup_printf(" (%u%%)", warning->rule.count_percent),
+		       warning->command);
 	}
 	return 0;
 }