mirror of
https://github.com/ckaczor/sqltoolsservice.git
synced 2026-01-15 01:25:40 -05:00
Use Logger overloads (#2163)
This commit is contained in:
@@ -11,7 +11,6 @@ using Microsoft.SqlTools.ServiceLayer.Scripting.Contracts;
|
||||
using Microsoft.SqlTools.Utility;
|
||||
using System;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using static Microsoft.SqlServer.Management.SqlScriptPublish.SqlScriptOptions;
|
||||
@@ -100,13 +99,12 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
||||
}
|
||||
catch (SqlException e)
|
||||
{
|
||||
Logger.Write(
|
||||
TraceEventType.Verbose,
|
||||
Logger.Verbose(
|
||||
string.Format("Exception getting server name", e));
|
||||
}
|
||||
}
|
||||
|
||||
Logger.Write(TraceEventType.Verbose, string.Format("Resolved server name '{0}'", serverName));
|
||||
Logger.Verbose(string.Format("Resolved server name '{0}'", serverName));
|
||||
return serverName;
|
||||
}
|
||||
|
||||
@@ -137,7 +135,7 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
||||
{
|
||||
if (scriptOptionsParameters == null)
|
||||
{
|
||||
Logger.Write(TraceEventType.Verbose, "No advanced options set, the ScriptOptions object is null.");
|
||||
Logger.Verbose("No advanced options set, the ScriptOptions object is null.");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -146,14 +144,14 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
||||
PropertyInfo advancedOptionPropInfo = advancedOptions.GetType().GetProperty(optionPropInfo.Name);
|
||||
if (advancedOptionPropInfo == null)
|
||||
{
|
||||
Logger.Write(TraceEventType.Warning, string.Format("Invalid property info name {0} could not be mapped to a property on SqlScriptOptions.", optionPropInfo.Name));
|
||||
Logger.Warning(string.Format("Invalid property info name {0} could not be mapped to a property on SqlScriptOptions.", optionPropInfo.Name));
|
||||
continue;
|
||||
}
|
||||
|
||||
object optionValue = optionPropInfo.GetValue(scriptOptionsParameters, index: null);
|
||||
if (optionValue == null)
|
||||
{
|
||||
Logger.Write(TraceEventType.Verbose, string.Format("Skipping ScriptOptions.{0} since value is null", optionPropInfo.Name));
|
||||
Logger.Verbose(string.Format("Skipping ScriptOptions.{0} since value is null", optionPropInfo.Name));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -183,13 +181,12 @@ namespace Microsoft.SqlTools.ServiceLayer.Scripting
|
||||
smoValue = Enum.Parse(advancedOptionPropInfo.PropertyType, (string)optionValue, ignoreCase: true);
|
||||
}
|
||||
|
||||
Logger.Write(TraceEventType.Verbose, string.Format("Setting ScriptOptions.{0} to value {1}", optionPropInfo.Name, smoValue));
|
||||
Logger.Verbose(string.Format("Setting ScriptOptions.{0} to value {1}", optionPropInfo.Name, smoValue));
|
||||
advancedOptionPropInfo.SetValue(advancedOptions, smoValue);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Write(
|
||||
TraceEventType.Warning,
|
||||
Logger.Warning(
|
||||
string.Format("An exception occurred setting option {0} to value {1}: {2}", optionPropInfo.Name, optionValue, e));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user