forked from takama/k8sapp
/
xlog.go
29 lines (25 loc) · 685 Bytes
/
xlog.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright 2017 Kubernetes Community Authors. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
package logger
import (
"os"
"github.com/k8s-community/k8sapp/pkg/logger"
"github.com/rs/xlog"
)
// newXLog creates "github.com/rs/xlog" logger
func newXLog(config *logger.Config) logger.Logger {
var out xlog.Output
switch config.Err {
// We should find more matches between types of output
case nil, os.Stderr:
out = xlog.NewConsoleOutput()
default:
out = xlog.NewConsoleOutput()
}
return xlog.New(xlog.Config{
Level: xlog.Level(config.Level),
Fields: config.Fields,
Output: out,
})
}