You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ImportsSystem.Collections.SpecializedImportsSystem.ConfigurationImportsSystem.Net.HttpImportsSystem.WebImportsDTS.Logging.MongoDBImportsDTS.Logging.MongoDB.ConfigurationImportsSerilog''' <summary>''' ''' </summary>''' <remarks></remarks>PublicClassLoggingDebuggingPublicSharedEnabledLogTypesAsNameValueCollection=Util.GetConfigSection("Logging")PublicSharedEnabledLogsAsNameValueCollection=Util.GetConfigSection("enabledLogs")'Private Shared sempaphore As Object = New Object()''' <summary>''' Proxy method to set the LogInstance properties and add LogInstance class to LogBuffer''' </summary>''' <param name="logType"></param>''' <param name="message"></param>''' <param name="traceKey"></param>''' <param name="user"></param>''' <param name="TS"></param>''' <returns></returns>''' <remarks></remarks>PublicSharedFunctionLog(ByVallogTypeAsString,ByValmessageAsString,OptionalByValtraceKeyAsLong=Nothing,OptionalByValuserAsString=Nothing,OptionalByValTSAsLong=Nothing)AsLongDimLogTSAsLongIfIsNothing(traceKey)OrtraceKey=0ThenThrowNewETDMSException(Util.t("traceKey must not be null. Please modify your method to either create a new "+"traceKey if it is the start of a request, or use an existing traceKey if it is "+"part of a request."))EndIfIfLoggingDebugging.EnabledLogTypes(logType)="True"ThenDimloginstanceAsNewLogInstance(m_logType:=logType,m_message:=message,m_user:=user,m_TS:=TS)LogTS=LogAggregator.AddLogInstance(loginstance,traceKey)Else'If logType = "query" Then' Dim LogEntry As New LogInstance(m_logType:=logType, m_message:=message, m_user:=user, m_TS:=TS)' LogTS = LoggingDebugging.AddLogBuffer(Props:=LogEntry, traceKey:=traceKey)'End IfLogTS=Now.Ticks()EndIfReturnLogTSEndFunction''' <summary>''' Fluh out from Logbuffer''' </summary>''' <param name="userPin"></param>''' <param name="traceKey"></param>''' <remarks></remarks>PublicOverloadsSharedSubFlushLog(ByValuserPinAsString,OptionalByValtraceKeyAsString=Nothing,OptionalByRefesTimeAsString=Nothing,OptionalByRefrequestAsHttpRequest=Nothing,OptionalByRefmessageAsHttpRequestMessage=Nothing)DimlogitemAsLogItem=NothingLogAggregator.TryGet(userPin,logitem,traceKey,esTime,request,message)EndSub''' <summary>''' Converts ticks to Date and Time''' </summary>''' <param name="ticks"></param>''' <returns></returns>''' <remarks></remarks>PublicSharedFunctionconvertTickstoDateTime(ByValticksAsLong)AsStringDimdtAsNewDateTime(ticks)ReturnFormat(dt,"MM/dd/yyy hh:mm:ss.fffffff")EndFunction''' <summary>''' Converts ticks to time''' </summary>''' <param name="ticks"></param>''' <returns></returns>''' <remarks></remarks>PublicSharedFunctionconvertTickstoTime(ByValticksAsLong)AsStringDimtimespanAsNewTimeSpan(ticks)ReturnString.Format("{0}:{1}:{2}:{3}",timespan.Hours.ToString("D2"),timespan.Minutes.ToString("D2"),timespan.Seconds.ToString("D2"),timespan.Milliseconds.ToString("D3"))EndFunction''' <summary>''' Converts ticks to Date and Time with 24 hrs''' </summary>''' <param name="ticks"></param>''' <returns></returns>''' <remarks></remarks>PublicSharedFunctionconvertTickstoLongDateTime(ByValticksAsLong)AsStringDimdtAsNewDateTime(ticks)Returndt.ToString()EndFunction''' <summary>''' Reads configuration values for serilog''' </summary>PublicSharedSubConfigure()'Serilog.Log.Logger = New Serilog.LoggerConfiguration().ReadFrom.AppSettings().CreateLogger()DimsettingsAsStructuredMongoDBSettings=ConfigurationManager.AppSettings.MongoDBSettings()Serilog.Log.Logger=NewSerilog.LoggerConfiguration()_.ReadFrom.AppSettings()_.Enrich.WithProperty("Application","user-service-dev")_.Enrich.WithProperty("Stage","local")_.WriteTo.StructuredMongoDB(settings)_.CreateLogger()Serilog.Log.Information("logger initialized")EndSubEndClass
Erroneous output
usingSystem;usingSystem.Net.Http;usingDTS.Logging.MongoDB;usingDTS.Logging.MongoDB.Configuration;usingMicrosoft.VisualBasic;usingSerilog;/// <summary>/// /// </summary>/// <remarks></remarks>publicpartialclassLoggingDebugging{publicstaticNameValueCollectionEnabledLogTypes=Util.GetConfigSection("Logging");publicstaticNameValueCollectionEnabledLogs=Util.GetConfigSection("enabledLogs");// Private Shared sempaphore As Object = New Object()/// <summary>/// Proxy method to set the LogInstance properties and add LogInstance class to LogBuffer/// </summary>/// <param name="logType"></param>/// <param name="message"></param>/// <param name="traceKey"></param>/// <param name="user"></param>/// <param name="TS"></param>/// <returns></returns>/// <remarks></remarks>publicstaticlongLog(stringlogType,stringmessage,longtraceKey=default(long),stringuser=null,longTS=default(long)){longLogTS;if(Information.IsNothing(traceKey)|traceKey==0){thrownewETDMSException(Util.t("traceKey must not be null. Please modify your method to either create a new "+"traceKey if it is the start of a request, or use an existing traceKey if it is "+"part of a request."));}if(LoggingDebugging.EnabledLogTypes(logType)=="True"){varloginstance=newLogInstance(m_logType:logType,m_message:message,m_user:user,m_TS:TS);LogTS=LogAggregator.AddLogInstance(loginstance,traceKey);}else{// If logType = "query" Then// Dim LogEntry As New LogInstance(m_logType:=logType, m_message:=message, m_user:=user, m_TS:=TS)// LogTS = LoggingDebugging.AddLogBuffer(Props:=LogEntry, traceKey:=traceKey)// End IfLogTS=Now.Ticks();}returnLogTS;}/// <summary>/// Fluh out from Logbuffer/// </summary>/// <param name="userPin"></param>/// <param name="traceKey"></param>/// <remarks></remarks>publicstaticvoidFlushLog(stringuserPin,stringtraceKey=null,refstringesTime=null,refHttpRequestrequest=null,refHttpRequestMessagemessage=null){LogItemlogitem=null;LogAggregator.TryGet(userPin,logitem,traceKey,esTime,request,message);}/// <summary>/// Converts ticks to Date and Time/// </summary>/// <param name="ticks"></param>/// <returns></returns>/// <remarks></remarks>publicstaticstringconvertTickstoDateTime(longticks){vardt=newDateTime(ticks);returnStrings.Format(dt,"MM/dd/yyy hh:mm:ss.fffffff");}/// <summary>/// Converts ticks to time/// </summary>/// <param name="ticks"></param>/// <returns></returns>/// <remarks></remarks>publicstaticstringconvertTickstoTime(longticks){vartimespan=newTimeSpan(ticks);returnstring.Format("{0}:{1}:{2}:{3}",timespan.Hours.ToString("D2"),timespan.Minutes.ToString("D2"),timespan.Seconds.ToString("D2"),timespan.Milliseconds.ToString("D3"));}/// <summary>/// Converts ticks to Date and Time with 24 hrs/// </summary>/// <param name="ticks"></param>/// <returns></returns>/// <remarks></remarks>publicstaticstringconvertTickstoLongDateTime(longticks){vardt=newDateTime(ticks);returndt.ToString();}/// <summary>/// Reads configuration values for serilog/// </summary>publicstaticvoidConfigure(){// Serilog.Log.Logger = New Serilog.LoggerConfiguration().ReadFrom.AppSettings().CreateLogger()StructuredMongoDBSettingssettings=ConfigurationManager.AppSettings.MongoDBSettings();Serilog.Log.Logger=newSerilog.LoggerConfiguration().ReadFrom.AppSettings().Enrich.WithProperty("Application","user-service-dev").Enrich.WithProperty("Stage","local").WriteTo.StructuredMongoDB(settings).CreateLogger();Serilog.Log.Information("logger initialized");}}
Expected output
usingSystem.Collections.Specialized;usingSystem;usingSystem.Net.Http;usingDTS.Logging.MongoDB;usingDTS.Logging.MongoDB.Configuration;usingMicrosoft.VisualBasic;usingSerilog;/// <summary>/// /// </summary>/// <remarks></remarks>publicpartialclassLoggingDebugging{publicstaticNameValueCollectionEnabledLogTypes=Util.GetConfigSection("Logging");publicstaticNameValueCollectionEnabledLogs=Util.GetConfigSection("enabledLogs");// Private Shared sempaphore As Object = New Object()/// <summary>/// Proxy method to set the LogInstance properties and add LogInstance class to LogBuffer/// </summary>/// <param name="logType"></param>/// <param name="message"></param>/// <param name="traceKey"></param>/// <param name="user"></param>/// <param name="TS"></param>/// <returns></returns>/// <remarks></remarks>publicstaticlongLog(stringlogType,stringmessage,longtraceKey=default(long),stringuser=null,longTS=default(long)){longLogTS;if(Information.IsNothing(traceKey)|traceKey==0){thrownewETDMSException(Util.t("traceKey must not be null. Please modify your method to either create a new "+"traceKey if it is the start of a request, or use an existing traceKey if it is "+"part of a request."));}if(LoggingDebugging.EnabledLogTypes(logType)=="True"){varloginstance=newLogInstance(m_logType:logType,m_message:message,m_user:user,m_TS:TS);LogTS=LogAggregator.AddLogInstance(loginstance,traceKey);}else{// If logType = "query" Then// Dim LogEntry As New LogInstance(m_logType:=logType, m_message:=message, m_user:=user, m_TS:=TS)// LogTS = LoggingDebugging.AddLogBuffer(Props:=LogEntry, traceKey:=traceKey)// End IfLogTS=Now.Ticks();}returnLogTS;}/// <summary>/// Fluh out from Logbuffer/// </summary>/// <param name="userPin"></param>/// <param name="traceKey"></param>/// <remarks></remarks>publicstaticvoidFlushLog(stringuserPin,stringtraceKey=null,refstringesTime=null,refHttpRequestrequest=null,refHttpRequestMessagemessage=null){LogItemlogitem=null;LogAggregator.TryGet(userPin,logitem,traceKey,esTime,request,message);}/// <summary>/// Converts ticks to Date and Time/// </summary>/// <param name="ticks"></param>/// <returns></returns>/// <remarks></remarks>publicstaticstringconvertTickstoDateTime(longticks){vardt=newDateTime(ticks);returnStrings.Format(dt,"MM/dd/yyy hh:mm:ss.fffffff");}/// <summary>/// Converts ticks to time/// </summary>/// <param name="ticks"></param>/// <returns></returns>/// <remarks></remarks>publicstaticstringconvertTickstoTime(longticks){vartimespan=newTimeSpan(ticks);returnstring.Format("{0}:{1}:{2}:{3}",timespan.Hours.ToString("D2"),timespan.Minutes.ToString("D2"),timespan.Seconds.ToString("D2"),timespan.Milliseconds.ToString("D3"));}/// <summary>/// Converts ticks to Date and Time with 24 hrs/// </summary>/// <param name="ticks"></param>/// <returns></returns>/// <remarks></remarks>publicstaticstringconvertTickstoLongDateTime(longticks){vardt=newDateTime(ticks);returndt.ToString();}/// <summary>/// Reads configuration values for serilog/// </summary>publicstaticvoidConfigure(){// Serilog.Log.Logger = New Serilog.LoggerConfiguration().ReadFrom.AppSettings().CreateLogger()StructuredMongoDBSettingssettings=ConfigurationManager.AppSettings.MongoDBSettings();Serilog.Log.Logger=newSerilog.LoggerConfiguration().ReadFrom.AppSettings().Enrich.WithProperty("Application","user-service-dev").Enrich.WithProperty("Stage","local").WriteTo.StructuredMongoDB(settings).CreateLogger();Serilog.Log.Information("logger initialized");}}
Details
There's code to avoid using statements being removed if they can't be found. It doesn't seem to be working here (see using System.Collections.Specialized;)
Raised here: #524 (comment)
DateTime.Now also not identified. The default references/imports may need updating
The text was updated successfully, but these errors were encountered:
Consolidated as a known limitation
Input code
Erroneous output
Expected output
Details
There's code to avoid using statements being removed if they can't be found. It doesn't seem to be working here (see using System.Collections.Specialized;)
Raised here: #524 (comment)
DateTime.Now also not identified. The default references/imports may need updating
The text was updated successfully, but these errors were encountered: