Flag for Logger Config yaml file name
Removed yaml filename from env.go and added its flag to scheduler.go
This commit is contained in:
parent
ef6d154d06
commit
24dbbb208f
5 changed files with 8 additions and 9 deletions
|
@ -14,10 +14,10 @@ var formatter ElektronFormatter
|
|||
var ElektronLog *LoggerImpl
|
||||
var logDir logDirectory
|
||||
|
||||
func BuildLogger(prefix string) {
|
||||
func BuildLogger(prefix string, logConfigFilename string) {
|
||||
|
||||
// read configuration from yaml
|
||||
config.GetConfig()
|
||||
config.GetConfig(logConfigFilename)
|
||||
|
||||
// create the log directory
|
||||
startTime := time.Now()
|
||||
|
|
|
@ -13,7 +13,7 @@ type Logger interface {
|
|||
type LoggerImpl struct {
|
||||
Type int
|
||||
AllowOnConsole bool
|
||||
LogFile *os.File
|
||||
LogFile *os.File
|
||||
next Logger
|
||||
}
|
||||
|
||||
|
|
|
@ -2,7 +2,6 @@ package elektronLogging
|
|||
|
||||
import (
|
||||
log "github.com/sirupsen/logrus"
|
||||
elekEnv "github.com/spdfg/elektron/environment"
|
||||
"gopkg.in/yaml.v2"
|
||||
"io/ioutil"
|
||||
)
|
||||
|
@ -48,9 +47,9 @@ type LoggerConfig struct {
|
|||
Format []string `yaml:"format"`
|
||||
}
|
||||
|
||||
func (c *LoggerConfig) GetConfig() *LoggerConfig {
|
||||
func (c *LoggerConfig) GetConfig(logConfigFilename string) *LoggerConfig {
|
||||
|
||||
yamlFile, err := ioutil.ReadFile(elekEnv.LogConfigYaml)
|
||||
yamlFile, err := ioutil.ReadFile(logConfigFilename)
|
||||
if err != nil {
|
||||
log.Printf("Error in reading yaml file #%v ", err)
|
||||
}
|
||||
|
|
|
@ -26,5 +26,3 @@ var RaplPassword = "RAPL_PSSWD"
|
|||
|
||||
// Location of the script that sets the powercap value for a host.
|
||||
var RaplThrottleScriptLocation = "RAPL_PKG_THROTTLE_SCRIPT_LOCATION"
|
||||
|
||||
var LogConfigYaml = "logConfig.yaml"
|
||||
|
|
|
@ -55,6 +55,7 @@ var fixFirstSchedPol = flag.String("fixFirstSchedPol", "", "Name of the scheduli
|
|||
var fixSchedWindow = flag.Bool("fixSchedWindow", false, "Fix the size of the scheduling window that every deployed scheduling policy should schedule, provided switching is enabled.")
|
||||
var schedWindowSize = flag.Int("schedWindowSize", 200, "Size of the scheduling window if fixSchedWindow is set.")
|
||||
var schedPolSwitchCriteria = flag.String("schedPolSwitchCriteria", "taskDist", "Scheduling policy switching criteria.")
|
||||
var logConfigFilename = flag.String("logConfigFilename", "logConfig.yaml", "Log Configuration file name")
|
||||
|
||||
// Short hand args
|
||||
func init() {
|
||||
|
@ -76,6 +77,7 @@ func init() {
|
|||
flag.BoolVar(fixSchedWindow, "fixSw", false, "Fix the size of the scheduling window that every deployed scheduling policy should schedule, provided switching is enabled (shorthand).")
|
||||
flag.IntVar(schedWindowSize, "swSize", 200, "Size of the scheduling window if fixSchedWindow is set (shorthand).")
|
||||
flag.StringVar(schedPolSwitchCriteria, "spsCriteria", "taskDist", "Scheduling policy switching criteria (shorthand).")
|
||||
flag.StringVar(logConfigFilename, "lgConfigName", "logConfig.yaml", "Log Configuration file name (shorthand).")
|
||||
}
|
||||
|
||||
func listAllSchedulingPolicies() {
|
||||
|
@ -223,7 +225,7 @@ func main() {
|
|||
if strings.Contains(*pcplogPrefix, "/") {
|
||||
log.Fatal("log file prefix should not contain '/'.")
|
||||
}
|
||||
elekLog.BuildLogger(*pcplogPrefix)
|
||||
elekLog.BuildLogger(*pcplogPrefix, *logConfigFilename)
|
||||
|
||||
// Starting PCP logging.
|
||||
if noPowercap {
|
||||
|
|
Reference in a new issue