mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-08 05:56:37 +00:00
fix: use log.file=eventlog as default value, if running as windows service (#1771)
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
@@ -34,6 +34,9 @@ func AddFlags(a *kingpin.Application, config *log.Config) {
|
||||
config.Config = new(promslog.Config)
|
||||
flag.AddFlags(a, config.Config)
|
||||
|
||||
config.File = &log.AllowedFile{}
|
||||
a.Flag(FileFlagName, FileFlagHelp).Default("stderr").SetValue(config.File)
|
||||
if config.File == nil {
|
||||
config.File = &log.AllowedFile{}
|
||||
}
|
||||
|
||||
a.Flag(FileFlagName, FileFlagHelp).Default(config.File.String()).SetValue(config.File)
|
||||
}
|
||||
|
||||
@@ -34,6 +34,10 @@ type AllowedFile struct {
|
||||
}
|
||||
|
||||
func (f *AllowedFile) String() string {
|
||||
if f == nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
return f.s
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user