From 6597728e5ca43d9e10da6785f2964a4d912637f9 Mon Sep 17 00:00:00 2001 From: Ben Date: Wed, 27 Mar 2024 08:13:36 +0100 Subject: [PATCH] Makes contract-clock log topic configurable --- ProjectPlugins/CodexPlugin/CodexSetup.cs | 1 + ProjectPlugins/CodexPlugin/CodexStartupConfig.cs | 3 +-- Tests/CodexTests/BasicTests/ExampleTests.cs | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/ProjectPlugins/CodexPlugin/CodexSetup.cs b/ProjectPlugins/CodexPlugin/CodexSetup.cs index d2560c4..6fcaf87 100644 --- a/ProjectPlugins/CodexPlugin/CodexSetup.cs +++ b/ProjectPlugins/CodexPlugin/CodexSetup.cs @@ -50,6 +50,7 @@ namespace CodexPlugin public CodexLogLevel DiscV5 { get; set; } public CodexLogLevel Libp2p { get; set; } + public CodexLogLevel ContractClock { get; set; } = CodexLogLevel.Warn; public CodexLogLevel? BlockExchange { get; } } diff --git a/ProjectPlugins/CodexPlugin/CodexStartupConfig.cs b/ProjectPlugins/CodexPlugin/CodexStartupConfig.cs index 72d154b..dbed45a 100644 --- a/ProjectPlugins/CodexPlugin/CodexStartupConfig.cs +++ b/ProjectPlugins/CodexPlugin/CodexStartupConfig.cs @@ -77,8 +77,7 @@ namespace CodexPlugin level = $"{level};" + $"{CustomTopics.DiscV5.ToString()!.ToLowerInvariant()}:{string.Join(",", discV5Topics)};" + $"{CustomTopics.Libp2p.ToString()!.ToLowerInvariant()}:{string.Join(",", libp2pTopics)};" + - // Contract clock is always set to warn. It logs a trace every second. - $"{CodexLogLevel.Warn.ToString().ToLowerInvariant()}:{string.Join(",", contractClockTopics)}"; + $"{CustomTopics.ContractClock.ToString().ToLowerInvariant()}:{string.Join(",", contractClockTopics)}"; if (CustomTopics.BlockExchange != null) { diff --git a/Tests/CodexTests/BasicTests/ExampleTests.cs b/Tests/CodexTests/BasicTests/ExampleTests.cs index 1d4d5d1..df32b75 100644 --- a/Tests/CodexTests/BasicTests/ExampleTests.cs +++ b/Tests/CodexTests/BasicTests/ExampleTests.cs @@ -62,7 +62,10 @@ namespace CodexTests.BasicTests var seller = AddCodex(s => s .WithName("Seller") - .WithLogLevel(CodexLogLevel.Trace, new CodexLogCustomTopics(CodexLogLevel.Error, CodexLogLevel.Error, CodexLogLevel.Warn)) + .WithLogLevel(CodexLogLevel.Trace, new CodexLogCustomTopics(CodexLogLevel.Error, CodexLogLevel.Error, CodexLogLevel.Warn) + { + ContractClock = CodexLogLevel.Trace, + }) .WithStorageQuota(11.GB()) .EnableMarketplace(geth, contracts, m => m .WithInitial(10.Eth(), sellerInitialBalance)