master > master: code go - vereinfachte logging
This commit is contained in:
@@ -20,9 +20,9 @@ import (
|
||||
func DisplayStartOfCase(index int, descr *string) {
|
||||
DisplayBar(80)
|
||||
if descr == nil || *descr == "" {
|
||||
logging.LogPlain(fmt.Sprintf("\033[92;1mCASE %[1]v\033[0m.", index))
|
||||
logging.Plain("\033[92;1mCASE %[1]v\033[0m.", index)
|
||||
} else {
|
||||
logging.LogPlain(fmt.Sprintf("\033[92;1mCASE %[1]v\033[0m (\033[1;2m%[2]s\033[0m).", index, *descr))
|
||||
logging.Plain("\033[92;1mCASE %[1]v\033[0m (\033[1;2m%[2]s\033[0m).", index, *descr)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,25 +86,25 @@ func RepresentValue(value interface{}) interface{} {
|
||||
* ---------------------------------------------------------------- */
|
||||
|
||||
func DisplayStartOfAlgorithm(name string, inputs map[string]interface{}) {
|
||||
logging.LogPlain(fmt.Sprintf("Ausführung vom Algorithmus: \033[92;1m%[1]s\033[0m", name))
|
||||
logging.LogPlain("INPUTS")
|
||||
logging.Plain("Ausführung vom Algorithmus: \033[92;1m%[1]s\033[0m", name)
|
||||
logging.Plain("INPUTS")
|
||||
for varname, value := range inputs {
|
||||
logging.LogPlain(fmt.Sprintf(" - %[1]s = %[2]v", varname, RepresentValue(value)))
|
||||
logging.Plain(" - %[1]s = %[2]v", varname, RepresentValue(value))
|
||||
}
|
||||
}
|
||||
|
||||
func DisplayEndOfAlgorithm(outputs map[string]interface{}) {
|
||||
logging.LogPlain("OUTPUTS:")
|
||||
logging.Plain("OUTPUTS:")
|
||||
for varname, value := range outputs {
|
||||
logging.LogPlain(fmt.Sprintf(" - %[1]s = %[2]v", varname, RepresentValue(value)))
|
||||
logging.Plain(" - %[1]s = %[2]v", varname, RepresentValue(value))
|
||||
}
|
||||
}
|
||||
|
||||
func DisplayMetrics() {
|
||||
// logging.LogPlain(fmt.Sprintf("Dauer der Ausführung: t = \033[1m%[1]v\033[0m", metrics.GetTimeElapsed()))
|
||||
logging.LogPlain(fmt.Sprintf("Dauer der Ausführung: t = \033[1m%[1]v\033[0m", metrics.GetTimeElapsedLongFormat()))
|
||||
logging.LogPlain(fmt.Sprintf("Kosten (Zeit): T(n) = \033[1m%[1]v\033[0m", metrics.GetTimeCost()))
|
||||
logging.LogPlain(fmt.Sprintf("Kosten (Platz): S(n) = \033[1m%[1]v\033[0m", metrics.GetSpaceCost()))
|
||||
// logging.Plain("Dauer der Ausführung: t = \033[1m%[1]v\033[0m", metrics.GetTimeElapsed())
|
||||
logging.Plain("Dauer der Ausführung: t = \033[1m%[1]v\033[0m", metrics.GetTimeElapsedLongFormat())
|
||||
logging.Plain("Kosten (Zeit): T(n) = \033[1m%[1]v\033[0m", metrics.GetTimeCost())
|
||||
logging.Plain("Kosten (Platz): S(n) = \033[1m%[1]v\033[0m", metrics.GetSpaceCost())
|
||||
return
|
||||
}
|
||||
|
||||
@@ -117,6 +117,6 @@ func DisplayBar(options ...int) {
|
||||
if len(options) > 0 {
|
||||
n = options[0]
|
||||
}
|
||||
logging.LogPlain(fmt.Sprintf("+%[1]s+", strings.Repeat("-", n)))
|
||||
logging.Plain("+%[1]s+", strings.Repeat("-", n))
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user