// trace writes some trace (if there is a Tracer set). func trace(t *tracer.Tracer, format string, args ...interface{}) { if t.Should(tracer.LevelDebug) { // add the 'signature' prefix to trace if len(format) > 0 { format = stewstrings.MergeStrings("signature: ", format) } // trace this t.Trace(tracer.LevelDebug, format, args...) } }
func HashWithKeysWithTrace(body, publicKey, privateKey []byte, t *tracer.Tracer) string { if t.Should(tracer.LevelDebug) { t.Trace(tracer.LevelDebug, "HashWithKeys: body=", body) t.Trace(tracer.LevelDebug, "HashWithKeys: publicKey=", publicKey) t.Trace(tracer.LevelDebug, "HashWithKeys: privateKey=", privateKey) } hash := Hash(string(strings.JoinBytes([]byte(HashWithKeysSeparator), body, publicKey, privateKey))) if t.Should(tracer.LevelDebug) { t.Trace(tracer.LevelDebug, "HashWithKeys: Output: %s", hash) } return hash }