1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | func SampleLogging() { //Different Logging Levels criticalLevel, _ := shim.LogLevel("CRITICAL") errorLevel, _ := shim.LogLevel("ERROR") warningLevel, _ := shim.LogLevel("WARNING") noticeLevel, _ := shim.LogLevel("NOTICE") infoLevel, _ := shim.LogLevel("INFO") debugLevel, _ := shim.LogLevel("DEBUG") //Logging level at the shim level shim.SetLoggingLevel(infoLevel) //Create a logger instance myLogger := shim.NewLogger("SampleChaincodeLogger") //Set logging level on logger instance myLogger.SetLevel(infoLevel) //Check logging level fmt.Println(myLogger.IsEnabledFor(infoLevel)) //Log statements myLogger.Info("Info Message") myLogger.Critical("Critical Message") myLogger.Warning("Warning Message") myLogger.Error("Error Message") myLogger.Notice("Notice Message") myLogger.Debug("Debug Message") } |
欢迎光临 电子技术论坛_中国专业的电子工程师学习交流社区-中电网技术论坛 (http://bbs.eccn.com/) | Powered by Discuz! 7.0.0 |