Description: Fix promlog invocation -- Backported fix from commit
    cd4a524848ca037f7daa1a27a238f731c0e4c0c7
Forwarded: https://github.com/prometheus/alertmanager/issues/1706
Author: Paul Traylor <kungfudiscomonkey@gmail.com>
Date:   Thu Dec 13 20:58:43 2018 +0900

--- a/cmd/alertmanager/main.go
+++ b/cmd/alertmanager/main.go
@@ -47,6 +47,7 @@
 	"github.com/prometheus/client_golang/prometheus"
 	"github.com/prometheus/client_golang/prometheus/promhttp"
 	"github.com/prometheus/common/promlog"
+	promlogflag "github.com/prometheus/common/promlog/flag"
 	"github.com/prometheus/common/route"
 	"github.com/prometheus/common/version"
 	"github.com/prometheus/prometheus/pkg/labels"
@@ -84,6 +85,7 @@
 		},
 		[]string{"handler", "method"},
 	)
+	promlogConfig = promlog.Config{}
 )
 
 func init() {
@@ -134,16 +136,11 @@
 		runtime.SetMutexProfileFraction(20)
 	}
 
-	logLevel := &promlog.AllowedLevel{}
-	if err := logLevel.Set("info"); err != nil {
-		panic(err)
-	}
 	var (
 		configFile      = kingpin.Flag("config.file", "Alertmanager configuration file name.").Default("/etc/prometheus/alertmanager.yml").String()
 		dataDir         = kingpin.Flag("storage.path", "Base path for data storage.").Default("/var/lib/prometheus/alertmanager/").String()
 		retention       = kingpin.Flag("data.retention", "How long to keep data for.").Default("120h").Duration()
 		alertGCInterval = kingpin.Flag("alerts.gc-interval", "Interval between alert GC.").Default("30m").Duration()
-		logLevelString  = kingpin.Flag("log.level", "Only log messages with the given severity or above.").Default("info").Enum("debug", "info", "warn", "error")
 
 		externalURL   = kingpin.Flag("web.external-url", "The URL under which Alertmanager is externally reachable (for example, if Alertmanager is served via a reverse proxy). Used for generating relative and absolute links back to Alertmanager itself. If the URL has a path portion, it will be used to prefix all HTTP endpoints served by Alertmanager. If omitted, relevant URL components will be derived automatically.").String()
 		routePrefix   = kingpin.Flag("web.route-prefix", "Prefix for the internal routes of web endpoints. Defaults to path of --web.external-url.").String()
@@ -165,12 +162,13 @@
 		peerReconnectTimeout = kingpin.Flag("cluster.reconnect-timeout", "Length of time to attempt to reconnect to a lost peer.").Default(cluster.DefaultReconnectTimeout.String()).Duration()
 	)
 
+	promlogflag.AddFlags(kingpin.CommandLine, &promlogConfig)
+
 	kingpin.Version(version.Print("alertmanager"))
 	kingpin.CommandLine.GetFlag("help").Short('h')
 	kingpin.Parse()
 
-	logLevel.Set(*logLevelString)
-	logger := promlog.New(*logLevel)
+	logger := promlog.New(&promlogConfig)
 
 	level.Info(logger).Log("msg", "Starting Alertmanager", "version", version.Info())
 	level.Info(logger).Log("build_context", version.BuildContext())
