Skip to content

Commit

Permalink
Update BeaconClientOptions.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
uink45 committed Oct 18, 2024
1 parent 0555e66 commit 2b8b7e7
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion src/Lantern.Beacon/BeaconClientOptions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Lantern.Beacon.Sync;
using Lantern.Beacon.Sync.Types;
using Microsoft.Extensions.Logging;
using SszSharp;

namespace Lantern.Beacon;
Expand All @@ -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
Expand Down Expand Up @@ -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<LogLevel>(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))
{
Expand Down

0 comments on commit 2b8b7e7

Please sign in to comment.