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

Jan 1, 2014 at 7:50 PM
Edited Jan 1, 2014 at 7:52 PM
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)
    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.
Jan 2, 2014 at 7:51 AM
Hi Neolisk,

Thank you for your tip. I replaced the code as suggested by you.

// https://sfdl.codeplex.com/SourceControl/changeset/29942
Marked as answer by seji on 1/1/2014 at 11:51 PM