Exemple #1
0
// 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...)
	}

}
Exemple #2
0
func HashWithKeyWithTrace(body, key []byte, t *tracer.Tracer) string {

	if t.Should(tracer.LevelDebug) {
		t.Trace(tracer.LevelDebug, "HashWithKeys: body=", body)
		t.Trace(tracer.LevelDebug, "HashWithKeys: key=", key)
	}

	hash := Hash(string(strings.JoinBytes([]byte(HashWithKeysSeparator), body, key)))

	if t.Should(tracer.LevelDebug) {
		t.Trace(tracer.LevelDebug, "HashWithKeys: Output: %s", hash)
	}

	return hash

}