Logging: Hide trace logging behind flag
This commit is contained in:
parent
470c899400
commit
44e273137d
@ -101,6 +101,7 @@ Public Class LogConfig
|
|||||||
|
|
||||||
Private _config As LoggingConfiguration
|
Private _config As LoggingConfiguration
|
||||||
Private _isDebug As Boolean = False
|
Private _isDebug As Boolean = False
|
||||||
|
Private _isTrace As Boolean = False
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
#Region "Public Properties"
|
#Region "Public Properties"
|
||||||
@ -139,7 +140,17 @@ Public Class LogConfig
|
|||||||
End Get
|
End Get
|
||||||
Set(isDebug As Boolean)
|
Set(isDebug As Boolean)
|
||||||
_isDebug = isDebug
|
_isDebug = isDebug
|
||||||
ReloadConfig(isDebug)
|
ReloadConfig(isDebug, _isTrace)
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
|
Public Property Trace As Boolean
|
||||||
|
Get
|
||||||
|
Return _isTrace
|
||||||
|
End Get
|
||||||
|
Set(isTrace As Boolean)
|
||||||
|
_isTrace = isTrace
|
||||||
|
ReloadConfig(_isDebug, isTrace)
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
@ -467,7 +478,8 @@ Public Class LogConfig
|
|||||||
''' Reconfigures and re-adds all loggers, optionally adding the debug rule.
|
''' Reconfigures and re-adds all loggers, optionally adding the debug rule.
|
||||||
''' </summary>
|
''' </summary>
|
||||||
''' <param name="Debug">Adds the Debug rule if true.</param>
|
''' <param name="Debug">Adds the Debug rule if true.</param>
|
||||||
Private Sub ReloadConfig(Optional Debug As Boolean = False)
|
''' <param name="Trace">Adds the Trace rule if true.</param>
|
||||||
|
Private Sub ReloadConfig(Optional Debug As Boolean = False, Optional Trace As Boolean = False)
|
||||||
' Clear Logging Rules
|
' Clear Logging Rules
|
||||||
_config.LoggingRules.Clear()
|
_config.LoggingRules.Clear()
|
||||||
|
|
||||||
@ -476,11 +488,14 @@ Public Class LogConfig
|
|||||||
|
|
||||||
' Add debug rule, if configured
|
' Add debug rule, if configured
|
||||||
If Debug Then
|
If Debug Then
|
||||||
_config.AddRuleForAllLevels(TARGET_TRACE)
|
|
||||||
_config.AddRule(LogLevel.Debug, LogLevel.Error, TARGET_DEBUG)
|
_config.AddRule(LogLevel.Debug, LogLevel.Error, TARGET_DEBUG)
|
||||||
_config.AddRule(LogLevel.Debug, LogLevel.Error, TARGET_MEMORY)
|
_config.AddRule(LogLevel.Debug, LogLevel.Error, TARGET_MEMORY)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If Trace Then
|
||||||
|
_config.AddRuleForAllLevels(TARGET_TRACE)
|
||||||
|
End If
|
||||||
|
|
||||||
' Reload all running loggers
|
' Reload all running loggers
|
||||||
LogFactory.ReconfigExistingLoggers()
|
LogFactory.ReconfigExistingLoggers()
|
||||||
End Sub
|
End Sub
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user