proof of concept: log node alias, pubkey, block height

This commit is contained in:
Carsten Otto
2021-05-20 22:27:32 +01:00
parent 052a8328d7
commit 0724dad7fa
44 changed files with 5786 additions and 90 deletions

View File

@@ -2,7 +2,9 @@ package de.cotto.lndmanagej;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
@EnableScheduling
@SpringBootApplication
public class Application {
public static void main(String[] arguments) {

View File

@@ -0,0 +1,32 @@
package de.cotto.lndmanagej;
import de.cotto.lndmanagej.grpc.GrpcGetInfo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
@Component
public class InfoLogger {
private final Logger logger = LoggerFactory.getLogger(getClass());
private final GrpcGetInfo grpcGetInfo;
public InfoLogger(GrpcGetInfo grpcGetInfo) {
this.grpcGetInfo = grpcGetInfo;
}
@Scheduled(fixedRate = 60_000)
public void logAlias() {
logger.info("Alias: {}", grpcGetInfo.getAlias());
}
@Scheduled(fixedRate = 60_000)
public void logPubkey() {
logger.info("Pubkey: {}", grpcGetInfo.getPubkey());
}
@Scheduled(fixedRate = 5_000)
public void logBlockHeight() {
logger.info("Block Height: {}", grpcGetInfo.getBlockHeight());
}
}