Ejemplo n.º 1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            CustomLogEntry log = new CustomLogEntry();

            log.Message = txtLog.Text;
            log.Categories.Add(Category.General);
            log.Priority = Priority.Normal;
            log.MyStuff  = string.Format("This is my stuff {0}", txtLog.Text);

            ExceptionLogWriter.Write(new NullReferenceException());

            writer.Write(log);
        }
Ejemplo n.º 2
0
        public void Activity_ExceptionLogger()
        {
            var reader        = new ExceptionLogReader();
            var writer        = new ExceptionLogWriter();
            var log           = new ExceptionLog();
            var preSaveCount  = Defaults.Integer;
            var postSaveCount = Defaults.Integer;

            Tables.DropMigrationHistory();

            preSaveCount  = reader.GetAll().Count();
            log           = writer.Save(log);
            postSaveCount = reader.GetAll().Count();
            Assert.IsTrue(log.ExceptionLogId != Defaults.Integer);
            Assert.IsTrue(postSaveCount == preSaveCount + 1);
        }
Ejemplo n.º 3
0
        static void Main()
        {
            LogManager.Configuration.Variables["dir"]  = new FileInfo(Application.ExecutablePath).Directory.FullName + Path.DirectorySeparatorChar;
            LogManager.Configuration.Variables["dir2"] = DateTime.Now.ToString("yyyy-MM-dd");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            try
            {
                Application.Run(new CameraApiSampleWindow());
            }
            catch (Exception ex)
            {
                ExceptionLogWriter.WriteLog(ex, Exception_Log);
            }
        }
Ejemplo n.º 4
0
        public static void WriteException(Exception ex, Logger logger)
        {
            if (IVLCamVariables.isCapturing)
            {
                IVLCamVariables.intucamHelper.WriteCaptureLog();
            }
            IntucamBoardCommHelper.BulkLogList.RemoveAll(x => (x.Count == 0));
            IVLCamVariables.logClass.BulkTransferLogList.AddRange(IntucamBoardCommHelper.BulkLogList);
            IntucamBoardCommHelper.InterruptLogList.RemoveAll(x => x.Count == 0);
            IVLCamVariables.logClass.BulkTransferLogList.AddRange(IntucamBoardCommHelper.InterruptLogList);
            IVLCamVariables.logClass.BulkTransferLogList = IVLCamVariables.logClass.BulkTransferLogList.OrderBy(x => x["TimeStamp"]).ToList();;
            IntucamBoardCommHelper.BulkLogList.Clear();
            IVLCamVariables.logClass.InterruptTransferLogList.AddRange(IntucamBoardCommHelper.InterruptLogList);

            IntucamBoardCommHelper.InterruptLogList.Clear();
            IVLCamVariables.logClass.CameraLogList.AddRange(IVLCamVariables.CameraLogList);
            IVLCamVariables.CameraLogList.Clear();
            IVLCamVariables.logClass.FrameLogList.AddRange(Camera.frameLogList);
            IVLCamVariables.logClass.WriteLogs2File();
            ExceptionLogWriter.WriteLog(ex, logger);
        }