package logging
import (
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"gopkg.in/yaml.v2"
"io/ioutil"
)
type LoggerConfig struct {
SchedTraceConfig struct {
Enabled bool `yaml:"enabled"`
FilenameExtension string `yaml:"filenameExtension"`
AllowOnConsole bool `yaml:"allowOnConsole"`
} `yaml:"schedTrace"`
PCPConfig struct {
} `yaml:"pcp"`
ConsoleConfig struct {
MinLogLevel string `yaml:"minLogLevel"`
} `yaml:"console"`
SPSConfig struct {
} `yaml:"sps"`
TaskDistrConfig struct {
} `yaml:"clsfnTaskDistrOverhead"`
SchedWindowConfig struct {
} `yaml:"schedWindow"`
Format []string `yaml:"format"`
}
func GetConfig(logConfigFilename string) (*LoggerConfig, error) {
yamlFile, err := ioutil.ReadFile(logConfigFilename)
if err != nil {
return nil, errors.Wrap(err, "failed to read log config file")
c := &LoggerConfig{}
err = yaml.Unmarshal(yamlFile, c)
log.Fatalf("Error in unmarshalling yaml: %v", err)
return c, nil