示例#1
0
 /// <summary>
 /// Assert that the log file contains the given string.
 /// </summary>
 /// <param name="contains"></param>
 internal void AssertLogDoesntContain(string contains)
 {
     if (FullLog.Contains(contains))
     {
         Console.WriteLine(FullLog);
     }
 }
示例#2
0
        public static void DumpLast(int max)
        {
            List <Entry> entries = new List <Entry>();

            while (true)
            {
                Entry entry = FullLog.Last();
                FullLog.Remove(FullLog.Last());
                if (entry == null)
                {
                    break;
                }
                entries.Add(entry);
            }
            ;
            int count = entries.Count;

            foreach (Entry entry in entries)
            {
                count--;
                if (count < max)
                {
                    System.Diagnostics.Trace.WriteLine(entry.ToString());
                }
            }
        }
示例#3
0
 /// <summary>
 /// Assert that the log file contains the given string.
 /// </summary>
 /// <param name="contains"></param>
 internal void AssertLogDoesntContain(string contains)
 {
     if (FullLog.Contains(contains))
     {
         Console.WriteLine(FullLog);
         Assert.True(false, String.Format("Log was not expected to contain '{0}', but did.", contains));
     }
 }
示例#4
0
        internal static void Add(string line)
        {
            //this is obviously a bit slow... we should just save the needed values in a struct and ToString them
            var entry = new Entry();

            QueryPerformanceCounter(ref entry.Time);
            entry.ThreadName = Thread.CurrentThread.Name;
            entry.String     = line;
            FullLog.Add(entry);
            //mData.Add(DeltaToString(start, now) + ":" + Thread.CurrentThread.Name + ":" + line);
            //System.Threading.Thread.MemoryBarrier();
        }
示例#5
0
 public static void Dump()
 {
     while (true)
     {
         Entry entry = FullLog.Last();
         FullLog.Remove(FullLog.Last());
         if (entry == null)
         {
             break;
         }
         System.Diagnostics.Trace.WriteLine(entry.ToString());
     }
     ;
 }
示例#6
0
 /// <summary>
 /// Assert that the log file contains the given string.
 /// </summary>
 /// <param name="contains"></param>
 internal void AssertLogDoesntContain(string contains)
 {
     if (FullLog.Contains(contains))
     {
         if (_testOutputHelper != null)
         {
             _testOutputHelper.WriteLine(FullLog);
         }
         else
         {
             Console.WriteLine(FullLog);
         }
         Assert.True(false, String.Format("Log was not expected to contain '{0}', but did.", contains));
     }
 }
示例#7
0
        private void Row_DoubleClick(object sender, MouseButtonEventArgs e)
        {
            log.Debug("[User Action]: Row Double Clicked");
            var row     = sender as DataGridRow;
            var content = row.Item as LogInfo;
            var query   = data.Select((value, index) => new { value, index = index + 1 }).Where(pair => pair.value.ErrorContent == content.ErrorContent && pair.value.DateTimeCombo == content.DateTimeCombo).Select(pair => pair.index).FirstOrDefault() - 1;

            FullLog.SelectedIndex = query;


            Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, (Action)(() =>
            {
                Tabs.SelectedIndex = 0;
                FullLog.UpdateLayout();
                FullLog.ScrollIntoView(FullLog.SelectedItem);
            }
                                                                                                ));
        }
示例#8
0
        /// <summary>
        /// Assert that the log file contains the given string.
        /// </summary>
        /// <param name="contains"></param>
        internal void AssertLogDoesntContain(string contains)
        {
            lock (_lockObj)
            {
                if (FullLog.Contains(contains))
                {
                    if (_testOutputHelper != null)
                    {
                        _testOutputHelper.WriteLine(FullLog);
                    }
                    else
                    {
                        Console.WriteLine(FullLog);
                    }

                    Assert.True(false, $"Log was not expected to contain '{contains}', but did.");
                }
            }
        }
示例#9
0
 /// <summary>
 /// Assert that the log file contains the given string.
 /// </summary>
 /// <param name="contains"></param>
 internal void AssertLogDoesntContain(string contains)
 {
     Assert.IsFalse(FullLog.Contains(contains), String.Format("Log was not expected to contain '{0}', but did.", contains));
 }
示例#10
0
        public new bool Execute()
        {
            try
            {
                while (!State.HasFlag(VMState.HALT) && !State.HasFlag(VMState.FAULT))
                {
                    OpCode nextOpcode = OpCode.NOP;
                    if (CurrentContext.InstructionPointer < CurrentContext.Script.Length)
                    {
                        nextOpcode = CurrentContext.NextInstruction;

                        if (this.FullLog != null)
                        {
                            this.FullLog.NextOp(CurrentContext.InstructionPointer, nextOpcode);
                            this.EvaluationStack.ClearRecord();
                        }
                        gas_consumed = checked (gas_consumed + GetPrice(nextOpcode) * ratio);
                        if (!testMode && gas_consumed > gas_amount)
                        {
                            if (FullLog != null)
                            {
                                FullLog.Error("gas_consumed > gas_amount");
                            }
                            State |= VMState.FAULT;
                            return(false);
                        }
                        if (!CheckItemSize(nextOpcode))
                        {
                            if (FullLog != null)
                            {
                                FullLog.Error("CheckItemSize");
                            }
                            State |= VMState.FAULT;
                            return(false);
                        }
                        if (!CheckStackSize(nextOpcode))
                        {
                            if (FullLog != null)
                            {
                                FullLog.Error("CheckStackSize");
                            }
                            State |= VMState.FAULT;
                            return(false);
                        }
                        if (!CheckArraySize(nextOpcode))
                        {
                            if (FullLog != null)
                            {
                                FullLog.Error("CheckArraySize");
                            }
                            State |= VMState.FAULT;
                            return(false);
                        }
                        if (!CheckInvocationStack(nextOpcode))
                        {
                            if (FullLog != null)
                            {
                                FullLog.Error("CheckInvocationStack");
                            }
                            State |= VMState.FAULT;
                            return(false);
                        }
                        if (!CheckBigIntegers(nextOpcode))
                        {
                            if (FullLog != null)
                            {
                                FullLog.Error("CheckBigIntegers");
                            }
                            State |= VMState.FAULT;
                            return(false);
                        }
                        if (!CheckDynamicInvoke(nextOpcode))
                        {
                            if (FullLog != null)
                            {
                                FullLog.Error("CheckBigIntegers");
                            }
                            State |= VMState.FAULT;
                            return(false);
                        }
                    }
                    StepInto();
                    if (FullLog != null)
                    {
                        VM.StackItem result = null;
                        ExecutionStackRecord.Op[] record = this.EvaluationStack.record.ToArray();
                        var ltype = this.EvaluationStack.GetLastRecordType();
                        if (ltype == ExecutionStackRecord.OpType.Push)
                        {
                            result = this.EvaluationStack.PeekWithoutLog();
                        }
                        else if (ltype == ExecutionStackRecord.OpType.Insert)
                        {
                            result = this.EvaluationStack.PeekWithoutLog(this.EvaluationStack.record.Last().ind);
                        }
                        else if (ltype == ExecutionStackRecord.OpType.Set)
                        {
                            result = this.EvaluationStack.PeekWithoutLog(this.EvaluationStack.record.Last().ind);
                        }
                        LogResult(nextOpcode, record, result);
                    }
                }
            }
            catch (Exception err)
            {
                State |= VMState.FAULT;
                return(false);
            }
            if (FullLog != null)
            {
                FullLog.Finish(State);
            }
            return(!State.HasFlag(VMState.FAULT));
        }
示例#11
0
 public void PersistLog(FullLog log)
 {
     _context.FullLogs.Add(log);
     _context.SaveChanges();
 }
示例#12
0
 public Request(FullLog log, string appkey, string appsecret)
 {
     this.log       = log;
     this.appkey    = appkey;
     this.appsecret = appsecret;
 }
示例#13
0
 public LoggingService(ILogsRepository logsRepo)
 {
     _logsRepo = logsRepo;
     _message  = new FullLog();
 }
示例#14
0
 private void SearchBar_SearchStart(object sender, Search.SearchEventArgs args)
 {
     FullLog.SelectedIndex = args.Line;
     FullLog.ScrollIntoView(FullLog.SelectedItem);
 }