-
-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide capability to configure log verbosity (#553)
* Provide docs * Provide capability to configure log verbosity * PROMITOR_LOGGING_MINIMUMLOGLEVEL -> PROMITOR_LOGGING_MINIMUMLEVEL * Docs - Change headers
- Loading branch information
1 parent
dca4f24
commit c7950a9
Showing
10 changed files
with
66 additions
and
17 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
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
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,26 @@ | ||
using System; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.Logging.Console; | ||
|
||
#pragma warning disable 618 | ||
|
||
namespace Promitor.Core.Telemetry.Loggers | ||
{ | ||
public class Logger : ConsoleLogger | ||
{ | ||
public Logger(string name) : base(name, (loggerName, logLevel) => IsFilteringRequired(logLevel), includeScopes: true) | ||
{ | ||
} | ||
|
||
private static bool IsFilteringRequired(LogLevel usedLogLevel) | ||
{ | ||
var rawMinimalLogLevel = Environment.GetEnvironmentVariable(EnvironmentVariables.Logging.MinimumLogLevel); | ||
if (Enum.TryParse(rawMinimalLogLevel, out LogLevel minimalLogLevel)) | ||
{ | ||
return minimalLogLevel <= usedLogLevel; | ||
} | ||
|
||
return LogLevel.Warning <= usedLogLevel; | ||
} | ||
} | ||
} |
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,11 @@ | ||
#pragma warning disable 618 | ||
|
||
namespace Promitor.Core.Telemetry.Loggers | ||
{ | ||
public class RuntimeLogger : Logger | ||
{ | ||
public RuntimeLogger() : base("Runtime") | ||
{ | ||
} | ||
} | ||
} |
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,11 @@ | ||
#pragma warning disable 618 | ||
|
||
namespace Promitor.Core.Telemetry.Loggers | ||
{ | ||
public class ValidationLogger : Logger | ||
{ | ||
public ValidationLogger() : base("Validation") | ||
{ | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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
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
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
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