Quantcast
Channel: SFDL Discussions Rss Feed
Viewing all articles
Browse latest Browse all 27

New Post: Optimize code in SFDL.NET 2 > Core > Loggin > Logger.vb

$
0
0
Replace WriteLog with the following:
  Public Sub WriteLog(ByVal _source As String, ByVal _log_str As String, Optional ByVal _log_type As LogType = LogType.Info)
    Dim logTypeString As String = GetLogTypeString(_log_type)
    Dim msg As String = String.Format("[{0}] [{1}] {2}", logTypeString, _source, _log_str)
    _var_log.AppendLine(msg)
    Debug.WriteLine(msg)
    RaiseEvent LogChanged(_var_log.ToString)
  End Sub

  Private Function GetLogTypeString(_log_type As LogType) As String
    Select Case _log_type
      Case LogType.Info : Return "INFO"
      Case LogType.Fehler : Return "FEHLER"
      Case LogType.Warnung : Return "WARNUNG"
      Case Else : Throw New NotImplementedException
    End Select
  End Function
"IF DEBUG" is not necessary, it will automatically work like that:
P.S. I was just browsing through a list of projects in VB.NET on codeplex, then browsing through your code for fun.

Viewing all articles
Browse latest Browse all 27

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>