예제 #1
0
        public static void LogDebug(string text, string source)
        {
            if (PhazeXLog.writeFileLog)
            {
                try
                {
                    if (Filename != null)
                    {
                        StreamWriter sw = new StreamWriter(Filename, true, Encoding.ASCII);
                        DateTime     dt = DateTime.Now;
                        sw.Write("[---debug---] [" + dt.ToShortDateString() + " " + dt.ToLongTimeString() + "] ");
                        sw.Write(text);
                        sw.Write(" (" + source + ")");
                        sw.Write(newLine);
                        sw.Close();
                    }
                }
                catch
                {
                }
            }

            if (OnLogDebug != null)
            {
                OnLogDebug.Invoke(text, source);
            }
        }
예제 #2
0
 public void Debug(string text)
 {
     if (LogOptions.EnableDebug)
     {
         OnLogDebug?.Invoke(text);
     }
 }
예제 #3
0
        private static void SendLog(LogEntry entry)
        {
            if (Macros.Editor)
            {
                Logger.AddLog(
                    String.Format("{0} {1} - {2}", entry.PrintSeverity(true), entry.PrintChannel(true), entry.PrintMessageColor()),
                    (int)entry.Severity,
                    entry.PrintStackTrace(),
                    entry.Channel
                    );
            }
            else
            {
                try
                {
                    File.ensureFolderExists(Logs.localLogDirectory());
                    var messagesPath = Logs.localLogMessagesPath();
                    var detailsPath  = Logs.localLogDetailsPath();
                    var writeMessage = String.Format(
                        "{0} - {1} {2} {3} {4}",
                        entry.PrintTimeStamp(),
                        entry.PrintSeverity(),
                        entry.PrintChannel(),
                        entry.PrintMessagePlain(),
                        Environment.NewLine
                        );

                    string stackTraceStr = entry.PrintStackTrace(0, "----");

                    if (Daemon.Logging.IsReporting() && entry.Severity >= ELogSeverity.Exception && entry.Report)
                    {
                        Daemon.Logging.Report(writeMessage, entry.Severity, stackTraceStr, entry.Trace);
                    }

                    Nanome.Core.Daemon.Logging.ScheduleForLogging(messagesPath, writeMessage);
                    var writeDetails = string.Format("{0}{1}{2}", writeMessage, stackTraceStr, Environment.NewLine);
                    Nanome.Core.Daemon.Logging.ScheduleForLogging(detailsPath, writeDetails);
                    if (directLogs)
                    {
                        var directPath = Logs.directLogMessagesPath();
                        Nanome.Core.Daemon.Logging.ScheduleForLogging(directPath, writeMessage);
                    }
                }
                catch (Exception e)
                {
                    UnityEngine.Debug.Log("Coult not log to history files:");
                    UnityEngine.Debug.LogException(e);
                }
            }

            if (OnLogDebug != null)
            {
                OnLogDebug.Invoke(entry.PrintMessagePlain(), (int)entry.Severity, entry.Channel);
            }
        }
예제 #4
0
 private void CloudSpatialAnchorSession_OnLogDebug(object sender, OnLogDebugEventArgs args)
 {
     OnLogDebug?.Invoke(sender, args);
     Debug.Log("CloudSpatialAnchorSession_OnLogDebug " + args.Message);
 }