コード例 #1
0
 /// <summary>
 /// Adds a log entry to the collection.
 /// </summary>
 /// <param name="logEntry"></param>
 public void Add(FlashLogEntry logEntry)
 {
     List.Add(logEntry);
 }
コード例 #2
0
        private bool PassesFilters(FlashLogEntry entry, LogFilter[] filters)
        {
            foreach (LogFilter f in filters)
            {
                if (f == null)
                    continue;

                switch (f.Type)
                {
                    case FilterType.Class:

                        if (entry.ClassName != (string) f.Criteria)
                            return false;

                        break;

                    case FilterType.Namespace:

                        if (entry.Namespace != (string) f.Criteria)
                            return false;

                        break;

                    case FilterType.LogLevel:

                        if (entry.Level < (LogLevel) f.Criteria)
                            return false;

                        break;

                }
            }

            return true;
        }
コード例 #3
0
ファイル: LoggerForm.cs プロジェクト: weihuoya/as2lib
 /// <summary>
 /// Fired when the Log collection adds an entry.
 /// </summary>
 /// <param name="collection"></param>
 /// <param name="newEntry"></param>
 private void Log_EntryAdded(FlashLogEntryCollection collection, FlashLogEntry newEntry)
 {
     m_entries.Add(newEntry);
     gridLog.Invoke(new ObjectEventHandler(AddLogEntryToGrid), new object[1] {newEntry});
 }
コード例 #4
0
ファイル: LoggerForm.cs プロジェクト: weihuoya/as2lib
        /// <summary>
        /// Sets the currently selected log entry and enables the properties
        /// button.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void gridLog_FocusRowEntered(object sender, SourceGrid2.RowEventArgs e)
        {
            btnProperties.Enabled = gridLog.Selection.SelectedRows.Length == 1;

            m_selectedentry = (FlashLogEntry) e.Row.Tag;
        }
コード例 #5
0
ファイル: LoggerForm.cs プロジェクト: weihuoya/as2lib
        private void AddLogEntryToGrid(FlashLogEntry entry)
        {
            //! validate against filters

            gridLog.Rows.Insert(1);

            //
            // Create cells
            //
            SourceGrid2.Cells.Real.Cell cell;

            //
            // Level
            //
            cell = new SourceGrid2.Cells.Real.Cell(entry.Level.ToString());
            gridLog[1,0] = cell;
            cell.BackColor = GetLevelCellColour(entry.Level);

            //
            // Namespace
            //
            cell = new SourceGrid2.Cells.Real.Cell(entry.Namespace);
            gridLog[1,1] = cell;

            //
            // Class name
            //
            cell = new SourceGrid2.Cells.Real.Cell(entry.ClassName);
            gridLog[1,2] = cell;

            //
            // Method name
            //
            cell = new SourceGrid2.Cells.Real.Cell(entry.MethodName);
            gridLog[1,3] = cell;

            //
            // Line number
            //
            cell = new SourceGrid2.Cells.Real.Cell(entry.LineNumber);
            gridLog[1,4] = cell;

            //
            // Message
            //
            cell = new SourceGrid2.Cells.Real.Cell(entry.Message);
            cell.WordWrap = true;
            gridLog[1,5] = cell;

            //
            // File name
            //
            cell = new SourceGrid2.Cells.Real.Cell(entry.FileName);
            gridLog[1,6] = cell;

            //
            // Timestamp
            //
            cell = new SourceGrid2.Cells.Real.Cell(entry.TimeStamp.ToString("MM/dd/yyyy HH:mm:ss:ff"));
            gridLog[1,7] = cell;

            gridLog.Rows[1].AutoSize(true, 5, 5);

            //
            // Hold the associated entry.
            //
            gridLog.Rows[1].Tag = entry;
        }
コード例 #6
0
ファイル: FlashLogger.cs プロジェクト: weihuoya/as2lib
        /// <summary>
        /// Parses out the string data into a FlashLogEntry and adds it to
        /// the LogEntries collection.
        /// </summary>
        /// <param name="socket"></param>
        /// <param name="data"></param>
        public void FlashSocket_DataRecieved(Socket socket, XmlNode node)
        {
            //
            // Check that the node is for us.
            //
            if (node.Attributes["type"] == null)
                return;

            if (node.Attributes["type"].Value != "trace")
                return;

            //
            // Create and fill the new log entry.
            //
            FlashLogEntry logEntry = new FlashLogEntry(node);

            //
            // Add the entry to the collection.
            //
            m_entries.Add(logEntry);
        }