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

@ -90,9 +90,8 @@ func switchTaskDistBased(baseSchedRef *BaseScheduler) string {
// Determine the distribution of tasks in the new scheduling window.
taskDist, err := def.GetTaskDistributionInWindow(baseSchedRef.schedWindowSize, baseSchedRef.tasks)
baseSchedRef.LogClsfnAndTaskDistOverhead(time.Now().Sub(startTime))
elekLog.ElektronLogger.Log(elekLogTypes.CONSOLE,
log.InfoLevel,
log.Fields{"Task Distribution": fmt.Sprintf("%f", taskDist)}, "Switching... ")
elekLog.ElektronLogger.WithFields(log.Fields{"Task Distribution": fmt.Sprintf("%f", taskDist)}).Log(elekLogTypes.CONSOLE,
log.InfoLevel, "Switching... ")
if err != nil {
// All the tasks in the window were only classified into 1 cluster.
// Max-Min and Max-GreedyMins would work the same way as Bin-Packing for this situation.