chore: improve log legibility

This commit is contained in:
andig 2024-06-18 09:43:44 +02:00
parent 06fe501edc
commit 97bb90c68b

View file

@ -266,10 +266,10 @@ func (c *Circuit) ValidatePower(old, new float64) float64 {
potential := c.maxPower - c.power
if delta > potential {
capped := max(0, old+potential)
c.log.DEBUG.Printf("validate power: %.5gW -> %.5gW <= %.5gW at %.5gW: capped at %.5gW", old, new, c.maxPower, c.power, capped)
c.log.DEBUG.Printf("validate power: %.5gW + (%.5gW -> %.5gW) > %.5gW capped at %.5gW", c.power, old, new, c.maxPower, capped)
new = capped
} else {
c.log.TRACE.Printf("validate power: %.5gW -> %.5gW <= %.5gW at %.5gW: ok", old, new, c.maxPower, c.power)
c.log.TRACE.Printf("validate power: %.5gW + (%.5gW -> %.5gW) <= %.5gW ok", c.power, old, new, c.maxPower)
}
}
@ -288,10 +288,10 @@ func (c *Circuit) ValidateCurrent(old, new float64) float64 {
potential := c.maxCurrent - c.current
if delta > potential {
capped := max(0, old+potential)
c.log.DEBUG.Printf("validate current: %.3gA -> %.3gA <= %.3gA at %.3gA: capped at %.3gA", old, new, c.maxCurrent, c.current, capped)
c.log.DEBUG.Printf("validate current: %.3gA + (%.3gA -> %.3gA) > %.3gA capped at %.3gA", c.current, old, new, c.maxCurrent, capped)
new = capped
} else {
c.log.TRACE.Printf("validate current: %.3gA -> %.3gA <= %.3gA at %.3gA: ok", old, new, c.maxCurrent, c.current)
c.log.TRACE.Printf("validate current: %.3gA + (%.3gA -> %.3gA) <= %.3gA ok", c.current, old, new, c.maxCurrent)
}
}