YetAnotherRelogger.Helpers.DebugHelper.Exception C# (CSharp) Method

Exception() public static method

public static Exception ( Exception exception, Loglevel level = Loglevel.Debug ) : void
exception System.Exception
level Loglevel
return void
        public static void Exception(Exception exception, Loglevel level = Loglevel.Debug)
        {
            Logger.Instance.AddLogmessage(
                new LogMessage
                    {
                        Color = Color.Red,
                        Loglevel = level,
                        Message = string.Format("Exception: [{0}]{1}{2}", exception.Message, Environment.NewLine, exception)
                    });
        }

Usage Example

 public static bool Check(string path)
 {
     try
     {
         Logger.Instance.Write("Checking plugin: {0}", path);
         if (File.Exists(path))
         {
             var check = Resources.Plugin.Split('\n')[0].TrimEnd();
             using (var fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
             {
                 var reader = new StreamReader(fs);
                 for (var i = 0; i < 3; i++)
                 {
                     var line = reader.ReadLine();
                     if (line != null && line.Equals(check))
                     {
                         Logger.Instance.Write("Plugin is installed and latest version");
                         return(true);
                     }
                 }
             }
         }
         else
         {
             Logger.Instance.Write("Plugin does not exist");
             return(false);
         }
     }
     catch (Exception ex)
     {
         DebugHelper.Exception(ex);
     }
     Logger.Instance.Write("Plugin is outdated!");
     return(false);
 }
All Usage Examples Of YetAnotherRelogger.Helpers.DebugHelper::Exception