mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-25 19:15:10 +00:00
修改日志方式
Signed-off-by: linqili <charlielin06@gmail.com>
This commit is contained in:
parent
f81fc36cdb
commit
92c4fb628a
3 changed files with 10 additions and 5 deletions
|
|
@ -22,6 +22,8 @@ repositories {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '2.0.+'
|
implementation group: 'org.hyperledger.fabric-chaincode-java', name: 'fabric-chaincode-shim', version: '2.0.+'
|
||||||
implementation group: 'org.json', name: 'json', version: '20180813'
|
implementation group: 'org.json', name: 'json', version: '20180813'
|
||||||
|
implementation group: 'org.slf4j', name: 'slf4j-api', version: '1.7.25'
|
||||||
|
implementation group: 'ch.qos.logbak', name: 'logback-classic', version: '1.1.11'
|
||||||
testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2'
|
testImplementation 'org.junit.jupiter:junit-jupiter:5.4.2'
|
||||||
testImplementation 'org.assertj:assertj-core:3.11.1'
|
testImplementation 'org.assertj:assertj-core:3.11.1'
|
||||||
testImplementation 'org.mockito:mockito-core:2.+'
|
testImplementation 'org.mockito:mockito-core:2.+'
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
|
#Thu Apr 16 01:34:12 CST 2020
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-bin.zip
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
|
|
||||||
|
|
@ -3,8 +3,6 @@ SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
package org.example;
|
package org.example;
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
|
|
||||||
import org.example.ledgerapi.State;
|
import org.example.ledgerapi.State;
|
||||||
import org.hyperledger.fabric.contract.Context;
|
import org.hyperledger.fabric.contract.Context;
|
||||||
import org.hyperledger.fabric.contract.ContractInterface;
|
import org.hyperledger.fabric.contract.ContractInterface;
|
||||||
|
|
@ -15,6 +13,8 @@ import org.hyperledger.fabric.contract.annotation.Info;
|
||||||
import org.hyperledger.fabric.contract.annotation.License;
|
import org.hyperledger.fabric.contract.annotation.License;
|
||||||
import org.hyperledger.fabric.contract.annotation.Transaction;
|
import org.hyperledger.fabric.contract.annotation.Transaction;
|
||||||
import org.hyperledger.fabric.shim.ChaincodeStub;
|
import org.hyperledger.fabric.shim.ChaincodeStub;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A custom context provides easy access to list of all commercial papers
|
* A custom context provides easy access to list of all commercial papers
|
||||||
|
|
@ -29,7 +29,7 @@ import org.hyperledger.fabric.shim.ChaincodeStub;
|
||||||
public class CommercialPaperContract implements ContractInterface {
|
public class CommercialPaperContract implements ContractInterface {
|
||||||
|
|
||||||
// use the classname for the logger, this way you can refactor
|
// use the classname for the logger, this way you can refactor
|
||||||
private final static Logger LOG = Logger.getLogger(CommercialPaperContract.class.getName());
|
private Logger LOG = LoggerFactory.getLogger(CommercialPaperContract.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Context createContext(ChaincodeStub stub) {
|
public Context createContext(ChaincodeStub stub) {
|
||||||
|
|
@ -83,6 +83,8 @@ public class CommercialPaperContract implements ContractInterface {
|
||||||
paper.setOwner(issuer);
|
paper.setOwner(issuer);
|
||||||
|
|
||||||
System.out.println(paper);
|
System.out.println(paper);
|
||||||
|
LOG.info("==== issue ====");
|
||||||
|
LOG.info("here is the paper:\n {}", paper);
|
||||||
// Add the paper to the list of all similar commercial papers in the ledger
|
// Add the paper to the list of all similar commercial papers in the ledger
|
||||||
// world state
|
// world state
|
||||||
ctx.paperList.addPaper(paper);
|
ctx.paperList.addPaper(paper);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue