diff --git a/src/Lantern.Beacon/BeaconClientOptions.cs b/src/Lantern.Beacon/BeaconClientOptions.cs index 42e3f9b..3cc95c6 100644 --- a/src/Lantern.Beacon/BeaconClientOptions.cs +++ b/src/Lantern.Beacon/BeaconClientOptions.cs @@ -1,5 +1,6 @@ using Lantern.Beacon.Sync; using Lantern.Beacon.Sync.Types; +using Microsoft.Extensions.Logging; using SszSharp; namespace Lantern.Beacon; @@ -18,6 +19,8 @@ public class BeaconClientOptions public bool GossipSubEnabled { get; set; } = true; + public LogLevel LogLevel { get; set; } = LogLevel.Information; + public string DataDirectoryPath { get; set; } = Path.Combine( Environment.OSVersion.Platform == PlatformID.Win32NT @@ -52,7 +55,24 @@ public static BeaconClientOptions Parse(string[] args) throw new ArgumentException("Missing value for --network"); } break; - + case "--log-level": + if (i + 1 < args.Length) + { + var levelString = args[++i]; + if (Enum.TryParse(levelString, true, out var logLevel)) + { + options.LogLevel = logLevel; + } + else + { + throw new ArgumentException($"Invalid log level: {levelString}"); + } + } + else + { + throw new ArgumentException("Missing value for --log-level"); + } + break; case "--genesis-time": if (i + 1 < argsList.Count && ulong.TryParse(argsList[++i], out var genesisTime)) {