Unable to write log message into chaincode log

(Subha Sahu) #1

Dear ALL,

I want to debug my function in chaincode. I am unable to find the way the message in chaincode log message.

My code is as below:
var logger = shim.NewLogger(“chaincode”)
logger.Info(“Get all the IDs and bytes value”);

Is it the right way ? or share me the link where i can get the help to write log message properly.

If i want to print the float or string value how can i write log message for that.

(Johan Dahl) #2

I don’t know this shim package but if it has the same functions as the built in logger can you use the Infof() function to write numbers in the message. For example

logger.Infof("%s has %d items", name, count)

(system) closed #3

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.