Used WithField() and Logf() where required.
Used elektronLogger#WithField(...) for single key-value pair. Used elektronLogger#Logf(...) where formatted string is required.
This commit is contained in:
parent
3b70a13cc8
commit
12f827c0fe
7 changed files with 91 additions and 72 deletions
|
@ -90,13 +90,15 @@ func UpdateEnvironment(offer *mesos.Offer) {
|
|||
var host = offer.GetHostname()
|
||||
// If this host is not present in the set of hosts.
|
||||
if _, ok := constants.Hosts[host]; !ok {
|
||||
elekLog.WithFields(log.Fields{"Adding host": host}).Log(CONSOLE, log.InfoLevel, "New host detected")
|
||||
elekLog.WithField("host", host).Log(CONSOLE, log.InfoLevel, "New host detected")
|
||||
// Add this host.
|
||||
constants.Hosts[host] = struct{}{}
|
||||
// Get the power class of this host.
|
||||
class := PowerClass(offer)
|
||||
elekLog.WithFields(log.Fields{"host": host, "PowerClass": class}).Log(CONSOLE,
|
||||
log.InfoLevel, "Registering the power class...")
|
||||
elekLog.WithFields(log.Fields{
|
||||
"host": host,
|
||||
"PowerClass": class,
|
||||
}).Log(CONSOLE, log.InfoLevel, "Registering the power class...")
|
||||
// If new power class, register the power class.
|
||||
if _, ok := constants.PowerClasses[class]; !ok {
|
||||
constants.PowerClasses[class] = make(map[string]struct{})
|
||||
|
|
Reference in a new issue