mirror of
https://github.com/prometheus-community/windows_exporter.git
synced 2026-02-14 17:06:36 +00:00
switch to go-kit logger
Signed-off-by: Jan-Otto Kröpke <mail@jkroepke.de>
This commit is contained in:
@@ -14,11 +14,12 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"github.com/alecthomas/kingpin/v2"
|
||||
"github.com/prometheus-community/windows_exporter/log"
|
||||
"github.com/go-kit/log"
|
||||
"github.com/go-kit/log/level"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
@@ -32,13 +33,13 @@ type Resolver struct {
|
||||
}
|
||||
|
||||
// NewResolver returns a Resolver structure.
|
||||
func NewResolver(file string) (*Resolver, error) {
|
||||
func NewResolver(file string, logger log.Logger) (*Resolver, error) {
|
||||
flags := map[string]string{}
|
||||
log.Infof("Loading configuration file: %v", file)
|
||||
level.Info(logger).Log("msg", fmt.Sprintf("Loading configuration file: %v", file))
|
||||
if _, err := os.Stat(file); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b, err := ioutil.ReadFile(file)
|
||||
b, err := os.ReadFile(file)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
package config
|
||||
|
||||
import (
|
||||
"gopkg.in/yaml.v3"
|
||||
"reflect"
|
||||
"testing"
|
||||
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
// Unmarshal good configuration file and confirm data is flattened correctly
|
||||
|
||||
Reference in New Issue
Block a user