Added functions to logging library

Added Logf() and WithFields() functions.
Logf() for logging formatted messages.
WithFields() for handling optional log fields.
This commit is contained in:
balandi1 2019-12-04 13:16:48 -05:00
parent b9592ed31c
commit bedfa52d7a
18 changed files with 319 additions and 260 deletions

View file

@ -52,8 +52,7 @@ func (tc TasksToClassify) taskObservationCalculator(task Task) []float64 {
} else if task.Watts != 0.0 {
return []float64{task.Watts}
} else {
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.FatalLevel,
log.Fields{}, "Unable to classify tasks. Missing Watts or ClassToWatts attribute in workload")
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.FatalLevel, "Unable to classify tasks. Missing Watts or ClassToWatts attribute in workload")
return []float64{0.0} // Won't reach here.
}
}
@ -108,8 +107,7 @@ func clusterSizeAvgMMMPU(tasks []Task, taskObservation func(task Task) []float64
} else {
// skip this value
// there is an error in the task config.
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.ErrorLevel,
log.Fields{}, err.Error())
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE, log.ErrorLevel, err.Error())
}
} else {
// There is only one observation for the task.