Exemplo n.º 1
0
        /// <summary>
        /// Log the error
        /// </summary>
        /// <param name="ex">the Exception</param>
        public static void Write(string ex)
        {
            LogError.StartLog(System.Configuration.ConfigurationSettings.AppSettings["LogFile"]);
            MyLogListener myLog = MyLogListener.instance;

            myLog.WriteLine(ex);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Log the error
        /// </summary>
        /// <param name="ex">the Exception</param>
        public static void Write(Exception ex)
        {
            LogError.StartLog(System.Configuration.ConfigurationSettings.AppSettings["LogFile"]);
            MyLogListener myLog = MyLogListener.instance;

            myLog.WriteLine(string.Format("{0} {1} {2}", ex.InnerException, ex.Message, ex.StackTrace));
        }
Exemplo n.º 3
0
        /// <summary>
        /// Init the Log Singleton
        /// </summary>
        /// <param name="logPath">local path of the log file</param>
        public static void StartLog(string logPath)
        {
            MyLogListener myLog = MyLogListener.Instance(logPath);

            myLog.MaxLogSize    = 500000; // 1Mo max
            myLog.WriteDateInfo = true;
            System.Diagnostics.Trace.Listeners.Add(myLog);
            System.Diagnostics.Trace.AutoFlush = true;
        }
Exemplo n.º 4
0
 public static MyLogListener Instance(string logPath)
 {
     lock (padlock)
     {
         if (instance == null)
         {
             instance = new MyLogListener(logPath);
         }
         return(instance);
     }
 }
Exemplo n.º 5
0
 public static MyLogListener Instance(string logPath)
 {
     lock (padlock)
     {
         if (instance == null)
         {
             instance = new MyLogListener(logPath);
         }
         return instance;
     }
 }