示例#1
0
 private void LoadSettings()
 {
     if (File.Exists("MPTailConfig.xml"))
     {
         XmlDocument doc = new XmlDocument();
         doc.Load("MPTailConfig.xml");
         string  name = Path.GetFileNameWithoutExtension(filename);
         XmlNode node = null;
         try
         {
             node =
                 doc.SelectSingleNode("/mptail/loggers/" + Category.ToString() + "/" + name.Replace(' ', '_') +
                                      "/config");
         }
         catch (Exception)
         {
             return;
         }
         if (node == null)
         {
             return;
         }
         string fname = node.Attributes["filename"].Value;
         if (filename != fname)
         {
             filename = fname;
         }
         searchParams.searchStr = node.Attributes["search-string"].Value;
         string color = node.Attributes["search-highlight-color"].Value;
         searchParams.highlightColor = Color.FromArgb(Int32.Parse(color));
         searchParams.caseSensitive  = (node.Attributes["search-casesensitive"].Value == "1");
     }
 }
示例#2
0
文件: Logger.cs 项目: ytak01/NBug
        private static void Write(string message, LoggerCategory category)
        {
            System.Diagnostics.Trace.Write(message + Environment.NewLine, category.ToString());

            if (Settings.DisplayDeveloperUI)
            {
                // InternalLogViewer.LogEntry(message, category);
            }

            var handler = LogWritten;

            if (handler != null)
            {
                handler(message, category);
            }
        }
示例#3
0
        private static void PrintToLog(object obj, LogType logType, LoggerCategory loggerCategory)
        {
            if (!DebuggerActive)
            {
                Debug.Log(obj.ToString());

                return;
            }

            var typeString     = logType.ToString();
            var categoryString = loggerCategory.ToString();

#if UNITY_EDITOR
            obj = FormatForConsole(ToRGBHex(Palette.GetColorFromCategory(loggerCategory)), ToRGBHex(Palette.GetColorFromType(logType)), categoryString, typeString, obj);
#elif UNITY_STANDALONE
            obj = FormatForFile(DateTime.Now, categoryString, typeString, obj);

            try
            {
                using (var outputStream = System.IO.File.AppendText(System.IO.Path.GetFullPath(string.Format("{0}/../Log.log", Application.dataPath))))
                {
                    outputStream.WriteLine(obj);
                    outputStream.Flush();
                    outputStream.Close();
                }
            }
            catch (Exception ex)
            {
                Debug.LogException(ex);
            }
            finally
            {
            }
#endif
            Debug.Log(obj);
        }
        private static void WriteLog(LoggerCategory categoryName, string source, string errorMessage)
        {
            SPDiagnosticsCategory category = Current.Areas[DiagnosticAreaName].Categories[categoryName.ToString()];

            Current.WriteTrace(0, category, category.TraceSeverity, string.Concat(string.Format("[{0}]", source), " ", errorMessage));
        }
示例#5
0
		internal void InternalLogEntry(string message, LoggerCategory category)
		{
			this.loggerListView.Items.Add(new ListViewItem(new[] { category.ToString().Remove(0, 4), DateTime.Now.ToString("HH:mm:ss"), message }));
		}
示例#6
0
 internal void InternalLogEntry(string message, LoggerCategory category)
 {
     this.loggerListView.Items.Add(new ListViewItem(new[] { category.ToString().Remove(0, 4), DateTime.Now.ToString("HH:mm:ss"), message }));
 }