Skip to content

Commit e5b12e0

Browse files
author
Stewart Miles
committed
Respect log level unless the -gvh_log_debug flag is present.
Logger will now only log all messages if the -gvh_log_debug command line flag is specified. Without the command line flag debug logging needs to be enabled in each component individually. Fixes #340 Change-Id: I0b1f38a3e438bd287aa7f906fc8d278df7321b94
1 parent 5eeb349 commit e5b12e0

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

source/VersionHandlerImpl/src/Logger.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,15 @@ public enum LogTarget {
4444
/// </summary>
4545
public class Logger {
4646

47+
/// <summary>
48+
/// Whether all log messages should be display.
49+
/// </summary>
50+
internal static bool DebugLoggingEnabled {
51+
get {
52+
return Environment.CommandLine.Contains("-gvh_log_debug");
53+
}
54+
}
55+
4756
/// <summary>
4857
/// Filter the log level.
4958
/// </summary>
@@ -107,7 +116,7 @@ private void LogToFile(string message) {
107116
/// <param name="level">Severity of the message, if this is below the currently selected
108117
/// Level property the message will not be logged.</param>
109118
public virtual void Log(string message, LogLevel level = LogLevel.Info) {
110-
if (level >= Level || ExecutionEnvironment.InBatchMode) {
119+
if (level >= Level || DebugLoggingEnabled) {
111120
switch (level) {
112121
case LogLevel.Debug:
113122
case LogLevel.Verbose:

0 commit comments

Comments
 (0)