mCore™ .NET SMS Library 1.2

mCore.SMS.ClearLog Method

Description

The ClearLog method clears the log file 'mCoreLib.log' located in the folder specified by the LogFolderPath property.

Returns Boolean value True if clearing is successful or else returns Boolean value False.

Namespace: mCore
Assembly: mCoreLib (in mCoreLib.dll)

Overload List:

Name Description
ClearLog () Removes all the entries from the log file mCoreLib.log
ClearLog (KeepLinesInLog As Integer) Removes all lines from the log file mCoreLib.log except the latest number of lines defined by KeepLinesInLog.

Remarks:

Exceptions:

mCore.GeneralException

Usage Example:

Visual Basic

Public Class MyClass
   Public WithEvents objSMS As New mCore.SMS

   Public Sub InitializeLog()
      Try
         objSMS.LogFolderPath = "C:\MyLogs"
         If objSMS.LogSize > 500 Then
            objSMS.ClearLog(10)
         End If
         objSMS.LogType = mCore.LogType.ErrorEventLog

      Catch ex As mCore.GeneralException
         MsgBox(ex.Message, MsgBoxStyle.Critical, "mCore Demo")

      Catch ex As Exception

      End Try
   End Function
End Class

 
C#
class MyClass
{
   public mCore.SMS objSMS = new mCore.SMS();
   public static void InitializeLog()
   {
      try
      {
         objSMS.LogFolderPath = "C:\\MyLogs";
         if (objSMS.LogSize > 500)
         {
            objSMS.ClearLog(10);
         }
         objSMS.LogType = mCore.LogType.ErrorEventLog;
      }

      catch (mCore.GeneralException e)
      {
         MessageBox.Show(e.ToString());
      }
      catch (Exception e)
      {
      }
   }
}

See Also:

mCore.SMS.LogType Property
mCore.SMS.LogFolderPath Property
mCore.SMS.LogSize Property
mCore.SMS.DebugMode Property

 

Copyright © IG Logix Softech Pvt Ltd, All Rights Reserved