-#define MESSAGE_FORMAT "request client=%s from=<%s> to=<%s> at %s: "
-#define MESSAGE_PARAMS query->client_name, \
- query->sender == NULL ? "undefined" : query->sender, \
- query->recipient == NULL ? "undefined" : query->recipient, \
- smtp_state_names[query->state]
+ char log_prefix[BUFSIZ];
+ log_prefix[0] = '\0';
+
+#define log_reply(Level, Msg, ...) \
+ if (log_level >= LOG_ ## Level) { \
+ if (log_prefix[0] == '\0') { \
+ query_format(log_prefix, BUFSIZ, \
+ config->log_format && config->log_format[0] ? \
+ config->log_format : DEFAULT_LOG_FORMAT, query); \
+ } \
+ __log(LOG_ ## Level, "%s: " Msg, log_prefix, ##__VA_ARGS__); \
+ }