Add developers startup arg (#997)

This commit is contained in:
Charles Gagnon
2020-07-23 16:09:58 -07:00
committed by GitHub
parent b42940c98a
commit 9fba9b1955
3 changed files with 43 additions and 8 deletions

View File

@@ -22,6 +22,8 @@ namespace Microsoft.SqlTools.Hosting.Utility
/// <summary>
/// Construct and parse command line options from the arguments array
/// </summary>
/// <param name="args">The args to parse</param>
/// <param name="serviceName">Name of the service to display</param>
public CommandOptions(string[] args, string serviceName)
{
ServiceName = serviceName;
@@ -89,7 +91,7 @@ namespace Microsoft.SqlTools.Hosting.Utility
/// <summary>
/// Whether the program should exit immediately. Set to true when the usage is printed.
/// </summary>
public bool ShouldExit { get; private set; }
public bool ShouldExit { get; protected set; }
/// <summary>
/// The locale our we should instantiate this service in

View File

@@ -70,14 +70,14 @@ namespace Microsoft.SqlTools.Utility
/// </summary>
public static void Flush()
{
TraceSource.Flush();
TraceSource?.Flush();
Trace.Flush();
}
public static void Close()
{
Flush();
TraceSource.Close();
TraceSource?.Close();
Trace.Close();
Listener = null; // Since we have closed the listener, set listener to null.
}
@@ -86,8 +86,11 @@ namespace Microsoft.SqlTools.Utility
get => tracingLevel;
set
{
// configures the source level filter. This alone is not enough for tracing that is done via "Trace" class instead of "TraceSource" object
TraceSource.Switch = new SourceSwitch(TraceSource.Name, value.ToString());
if(TraceSource != null)
{
// configures the source level filter. This alone is not enough for tracing that is done via "Trace" class instead of "TraceSource" object
TraceSource.Switch = new SourceSwitch(TraceSource.Name, value.ToString());
}
// configure the listener level filter
tracingLevel = value;
Listener.Filter = new EventTypeFilter(tracingLevel);
@@ -216,8 +219,8 @@ namespace Microsoft.SqlTools.Utility
TraceOutputOptions = TraceOptions.DateTime | TraceOptions.ProcessId | TraceOptions.ThreadId,
Filter = new EventTypeFilter(TracingLevel),
};
TraceSource.Listeners.Clear();
TraceSource.Listeners.Add(Listener);
TraceSource?.Listeners.Clear();
TraceSource?.Listeners.Add(Listener);
Trace.Listeners.Clear();
Trace.Listeners.Add(Listener);
}