forked from akkadotnet/akka.net
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Made
akka.cluster.sharding.verbose-debug-logging
accept a LogLevel
close akkadotnet#7097
- Loading branch information
1 parent
251622d
commit 42a9118
Showing
5 changed files
with
175 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/contrib/cluster/Akka.Cluster.Sharding/InternalConfigUtilities.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="InternalConfigUtilities.cs" company="Akka.NET Project"> | ||
// Copyright (C) 2009-2024 Lightbend Inc. <http://www.lightbend.com> | ||
// Copyright (C) 2013-2024 .NET Foundation <https://github.com/akkadotnet/akka.net> | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
|
||
using System; | ||
using Akka.Configuration; | ||
using Akka.Event; | ||
|
||
namespace Akka.Cluster.Sharding; | ||
|
||
/// <summary> | ||
/// INTERNAL API | ||
/// </summary> | ||
internal static class InternalConfigUtilities | ||
{ | ||
/// <summary> | ||
/// Null in this case means "off" | ||
/// </summary> | ||
/// <param name="coordinatorHocon">The HOCON config used by a shard coordinator</param> | ||
/// <returns></returns> | ||
/// <exception cref="ArgumentException"></exception> | ||
public static LogLevel? ParseVerboseLogSettings(Config coordinatorHocon) | ||
{ | ||
var logLevel = coordinatorHocon.GetString("akka.cluster.sharding.verbose-debug-logging"); | ||
return logLevel switch | ||
{ | ||
"off" => null, | ||
"on" => LogLevel.DebugLevel, | ||
"error" => LogLevel.ErrorLevel, | ||
"warning" => LogLevel.WarningLevel, | ||
"info" => LogLevel.InfoLevel, | ||
"debug" => LogLevel.DebugLevel, | ||
_ => throw new ArgumentException($"Unknown log level: {logLevel}") | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.