Commit dda29a1e authored by Dan Gershony's avatar Dan Gershony Committed by GitHub

Merge pull request #159 from dangershony/logger-changes

Update Breeze with the Logger changes (and submodule)
parents 55bf8c24 ffac7670
......@@ -20,18 +20,25 @@ namespace Breeze.Api
private readonly FullNode fullNode;
private readonly ApiFeatureOptions apiFeatureOptions;
private readonly IAsyncLoopFactory asyncLoopFactory;
private readonly ILogger logger;
public ApiFeature(IFullNodeBuilder fullNodeBuilder, FullNode fullNode, ApiFeatureOptions apiFeatureOptions, IAsyncLoopFactory asyncLoopFactory)
public ApiFeature(
IFullNodeBuilder fullNodeBuilder,
FullNode fullNode,
ApiFeatureOptions apiFeatureOptions,
IAsyncLoopFactory asyncLoopFactory,
ILoggerFactory loggerFactory)
{
this.fullNodeBuilder = fullNodeBuilder;
this.fullNode = fullNode;
this.apiFeatureOptions = apiFeatureOptions;
this.asyncLoopFactory = asyncLoopFactory;
this.logger = loggerFactory.CreateLogger(this.GetType().FullName);
}
public override void Start()
{
Logs.FullNode.LogInformation($"Api starting on url {this.fullNode.Settings.ApiUri}");
this.logger.LogInformation($"Api starting on url {this.fullNode.Settings.ApiUri}");
Program.Initialize(this.fullNodeBuilder.Services, this.fullNode);
this.TryStartKeepaliveMonitor();
......
......@@ -31,9 +31,6 @@ namespace Breeze.Daemon
{
IFullNodeBuilder fullNodeBuilder = null;
// configure logging
Logs.Configure(Logs.GetLoggerFactory(args));
// get the api uri
var apiUri = args.GetValueOf("apiuri");
......
......@@ -24,11 +24,19 @@ namespace Breeze.Wallet
private readonly Signals signals;
private ChainedBlock walletTip;
private readonly INodeLifetime nodeLifetime;
private readonly IAsyncLoopFactory asyncLoopFactory;
public ChainedBlock WalletTip => this.walletTip;
public ChainedBlock WalletTip => this.walletTip;
public LightWalletSyncManager(ILoggerFactory loggerFactory, IWalletManager walletManager, ConcurrentChain chain, Network network,
BlockNotification blockNotification, Signals signals, INodeLifetime nodeLifetime)
public LightWalletSyncManager(
ILoggerFactory loggerFactory,
IWalletManager walletManager,
ConcurrentChain chain,
Network network,
BlockNotification blockNotification,
Signals signals,
INodeLifetime nodeLifetime,
IAsyncLoopFactory asyncLoopFactory)
{
this.walletManager = walletManager as WalletManager;
this.chain = chain;
......@@ -37,6 +45,7 @@ namespace Breeze.Wallet
this.coinType = (CoinType)network.Consensus.CoinType;
this.logger = loggerFactory.CreateLogger(this.GetType().FullName);
this.nodeLifetime = nodeLifetime;
this.asyncLoopFactory = asyncLoopFactory;
}
/// <inheritdoc />
......@@ -148,7 +157,7 @@ namespace Breeze.Wallet
// if the chain is already past the date we want to sync from, we don't wait, even though the chain might not be fully downloaded.
if (this.chain.Tip.Header.BlockTime.LocalDateTime < date)
{
AsyncLoop.RunUntil("WalletFeature.DownloadChain", this.nodeLifetime.ApplicationStopping,
this.asyncLoopFactory.RunUntil("WalletFeature.DownloadChain", this.nodeLifetime.ApplicationStopping,
() => this.chain.Tip.Header.BlockTime.LocalDateTime >= date,
() => this.StartSync(this.chain.GetHeightAtTime(date)),
(ex) =>
......@@ -174,7 +183,7 @@ namespace Breeze.Wallet
// if the chain is already past the height we want to sync from, we don't wait, even though the chain might not be fully downloaded.
if (this.chain.Tip.Height < height)
{
AsyncLoop.RunUntil("WalletFeature.DownloadChain", this.nodeLifetime.ApplicationStopping,
this.asyncLoopFactory.RunUntil("WalletFeature.DownloadChain", this.nodeLifetime.ApplicationStopping,
() => this.chain.Tip.Height >= height,
() => this.StartSync(height),
(ex) =>
......
Subproject commit 9cc4517fcbeaffc607fee4d03a83a377b6ee79b4
Subproject commit 01447e3336cd12736d2466fa5d932c550ef549e9
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment