MEDIUM: log: report file name, line number, and directive name with log-format errors

Improve error log reporting in the format parser by always giving the
file name, line number, and directive name instead of the hard-coded
"log-format".

Previously we got this when dealing with log-format errors:
  [WARNING] 101/183012 (8561) : Warning: log-format variable name 'r' is not suited to HTTP mode
  [WARNING] 101/183012 (8561) : log-format: sample fetch <hdr(a,1)> may not be reliably used with 'log-format' because it needs 'HTTP request headers,HTTP response headers' which is not available here.
  [WARNING] 101/183012 (8561) : Warning: no such variable name 'k' in log-format

Now we have this :
  [WARNING] 101/183016 (8593) : parsing [fmt.cfg:8] : 'log-format' variable name 'r' is reserved for HTTP mode
  [WARNING] 101/183016 (8593) : parsing [fmt.cfg:8] : 'log-format' : sample fetch <hdr(a,1)> may not be reliably used here because it needs 'HTTP request headers,HTTP response headers' which is not available here.
  [WARNING] 101/183016 (8593) : parsing [fmt.cfg:15] : no such variable name 'k' in 'unique-id-format'
diff --git a/src/log.c b/src/log.c
index ed1f061..020c381 100644
--- a/src/log.c
+++ b/src/log.c
@@ -161,6 +161,17 @@
 	{  0,  0 }
 };
 
+/* return the name of the directive used in the current proxy for which we're
+ * currently parsing a header, when it is known.
+ */
+static inline const char *fmt_directive(const struct proxy *curproxy)
+{
+	if (curproxy->conf.args.ctx == ARGC_UIF)
+		return "unique-id-format";
+	else
+		return "log-format";
+}
+
 /*
  * callback used to configure addr source retrieval
  */
@@ -257,11 +268,14 @@
 					LIST_ADDQ(list_format, &node->list);
 				}
 				if (logformat_keywords[j].replace_by)
-					Warning("Warning: deprecated variable '%s' in log-format, please replace it with '%s'\n",
-					        logformat_keywords[j].name, logformat_keywords[j].replace_by);
+					Warning("parsing [%s:%d] : deprecated variable '%s' in '%s', please replace it with '%s'\n",
+					        curproxy->conf.args.file, curproxy->conf.args.line,
+					        logformat_keywords[j].name, fmt_directive(curproxy), logformat_keywords[j].replace_by);
 				return 0;
 			} else {
-				Warning("Warning: log-format variable name '%s' is not suited to HTTP mode\n", logformat_keywords[j].name);
+				Warning("parsing [%s:%d] : '%s' variable name '%s' is reserved for HTTP mode\n",
+				        curproxy->conf.args.file, curproxy->conf.args.line, fmt_directive(curproxy),
+				        logformat_keywords[j].name);
 				return -1;
 			}
 		}
@@ -269,7 +283,8 @@
 
 	j = var[var_len];
 	var[var_len] = 0;
-	Warning("Warning: no such variable name '%s' in log-format\n", var);
+	Warning("parsing [%s:%d] : no such variable name '%s' in '%s'\n",
+	        curproxy->conf.args.file, curproxy->conf.args.line, var, fmt_directive(curproxy));
 	var[var_len] = j;
 	return -1;
 }
@@ -322,7 +337,9 @@
 
 	expr = sample_parse_expr(cmd, &cmd_arg, trash.str, trash.size, &curpx->conf.args);
 	if (!expr) {
-		Warning("log-format: sample fetch <%s> failed with : %s\n", text, trash.str);
+		Warning("parsing [%s:%d] : '%s' : sample fetch <%s> failed with : %s\n",
+		        curpx->conf.args.file, curpx->conf.args.line, fmt_directive(curpx),
+		        text, trash.str);
 		return;
 	}
 
@@ -342,8 +359,9 @@
 		node->options |= LOG_OPT_RES_CAP; /* fetch method is response-compatible */
 
 	if (!(expr->fetch->val & cap))
-		Warning("log-format: sample fetch <%s> may not be reliably used %s because it needs '%s' which is not available here.\n",
-			text, cap == SMP_VAL_FE_LOG_END ? "with 'log-format'" : "here", sample_src_names(expr->fetch->use));
+		Warning("parsing [%s:%d] : '%s' : sample fetch <%s> may not be reliably used here because it needs '%s' which is not available here.\n",
+		        curpx->conf.args.file, curpx->conf.args.line, fmt_directive(curpx),
+			text, sample_src_names(expr->fetch->use));
 
 	/* check if we need to allocate an hdr_idx struct for HTTP parsing */
 	/* Note, we may also need to set curpx->to_log with certain fetches */
@@ -441,7 +459,8 @@
 				var = str;
 				break;
 			}
-			Warning("Skipping isolated argument in log-format line : '%%{%s}'\n", arg);
+			Warning("parsing [%s:%d] : Skipping isolated argument in '%s' line : '%%{%s}'\n",
+			        curproxy->conf.args.file, curproxy->conf.args.line, fmt_directive(curproxy), arg);
 			cformat = LF_INIT;
 			break;
 
@@ -490,7 +509,9 @@
 	}
 
 	if (pformat == LF_STARTVAR || pformat == LF_STARG || pformat == LF_STEXPR)
-		Warning("Ignoring end of truncated log-format line after '%s'\n", var ? var : arg ? arg : "%");
+		Warning("parsing [%s:%d] : Ignoring end of truncated '%s' line after '%s'\n",
+		        curproxy->conf.args.file, curproxy->conf.args.line, fmt_directive(curproxy),
+		        var ? var : arg ? arg : "%");
 
 	free(backfmt);
 }
diff --git a/src/proxy.c b/src/proxy.c
index f909d20..9317774 100644
--- a/src/proxy.c
+++ b/src/proxy.c
@@ -406,7 +406,8 @@
 	}
 	if (curproxy->to_log & (LW_REQ | LW_RESP)) {
 		curproxy->to_log &= ~(LW_REQ | LW_RESP);
-		Warning("config : 'option httplog' not usable with %s '%s' (needs 'mode http'). Falling back to 'option tcplog'.\n",
+		Warning("parsing [%s:%d] : 'option httplog' not usable with %s '%s' (needs 'mode http'). Falling back to 'option tcplog'.\n",
+			curproxy->conf.lfs_file, curproxy->conf.lfs_line,
 			proxy_type_str(curproxy), curproxy->id);
 	}
 	if (curproxy->conf.logformat_string == default_http_log_format ||