示例#1
0
        private static bool CanDisplay(DebugLogType debugLogType)
        {
                        #if UNITY_EDITOR
            if (!Application.isPlaying)
            {
                return(true);
            }
                        #endif
            if (KickStarter.settingsManager)
            {
                switch (KickStarter.settingsManager.showDebugLogs)
                {
                case ShowDebugLogs.Always:
                    return(true);

                case ShowDebugLogs.Never:
                    return(false);

                case ShowDebugLogs.OnlyWarningsOrErrors:
                    return(debugLogType != DebugLogType.Info);

                default:
                    return(true);
                }
            }
            return(true);
        }
示例#2
0
 public DebugModel(DateTime time, string description, DebugLogType debugLogType, int index)
 {
     this._dateTime     = time;
     this.Description   = description;
     this._debugLogType = debugLogType;
     this.Index         = index;
 }
 public void ShowInfo()
 {
     debugLogType = DebugLogType.None;
     text.text   += "\n";
     text.text   += AppInfo.GetAppInfo();
     text.rectTransform.sizeDelta = new Vector2(text.rectTransform.sizeDelta.x, text.preferredHeight > (text.transform.parent as RectTransform).sizeDelta.y ? text.preferredHeight :  (text.transform.parent as RectTransform).sizeDelta.y);
 }
示例#4
0
 public LogEntry(string logContent, string stackContent, DebugLogType logType)
 {
     this.logContent   = logContent;
     this.stackContent = stackContent;
     this.logType      = logType;
     this.logCount     = 1;
     this.selected     = false;
 }
示例#5
0
        public static void Log <T0>(DebugLogType type, T0 t0)
        {
            var buffer = new ObjectsBuffer(objectsBufferLocal.Value, type)
            {
                [0] = t0
            };

            LogInternal(buffer, 1);
        }
示例#6
0
 internal DebugLogItem(int logId, DateTime time, string source, DebugLogType type, string title, string data)
 {
     this.Logid  = logId;
     this.Type   = type;
     this.Time   = time;
     this.Source = source;
     this.Title  = title;
     this.Data   = data;
 }
示例#7
0
        public static void Log <T0, T1>(DebugLogType type, T0 t0, T1 t1)
        {
            var buffer = new ObjectsBuffer(objectsBufferLocal.Value, type)
            {
                [0] = t0,
                [1] = t1
            };

            LogInternal(buffer, 2);
        }
示例#8
0
        public static void Log <T0, T1, T2>(DebugLogType type, T0 t0, T1 t1, T2 t2)
        {
            var buffer = new ObjectsBuffer(objectsBufferLocal.Value, type)
            {
                [0] = t0,
                [1] = t1,
                [2] = t2
            };

            LogInternal(buffer, 3);
        }
        private void Start()
        {
#if UNITY_EDITOR
            if (addTestViewers)
            {
                AddTestViewers();
            }
#endif
#if !UNITY_EDITOR
            logType = DebugLogType.Full;
#endif
            CheckIsSingleInScene();
        }
示例#10
0
        public TraceLogger()
        {
            ConsoleTraceListener consoleTraceListener = new ConsoleTraceListener();

            Trace.Listeners.Add(consoleTraceListener);

            errorLog = new ErrorLogType(new ErrorTraceWriter());
            debugLog = new DebugLogType(new DebugTraceWriter());
            infoLog  = new InfoLogType(new InfoTraceWriter());

            logTypeTable = new Dictionary <LogType, AbstractLogType>
            {
                { LogType.Error, errorLog },
                { LogType.Debug, debugLog },
                { LogType.Info, infoLog }
            };
        }
示例#11
0
        private void Start()
        {
#if !UNITY_EDITOR
            chatEnabled = true;
            logType     = DebugLogType.Full;
#endif
            CheckIsSingleInScene();
            ServicePointManager.ServerCertificateValidationCallback = CertificateValidationMonoFix;
            usersJoinedBag = new ConcurrentBag <string>();
            usersLeftBag   = new ConcurrentBag <string>();
            messageQueue   = new ConcurrentQueue <Tuple <string, string> >();
            commandQueue   = new ConcurrentQueue <Tuple <string, string> >();
            if (chatEnabled)
            {
                InitTwitchClient();
                client.Connect();
            }
        }
示例#12
0
        internal static void WriteLogItem(
            DateTime time,
            string source,
            DebugLogType type,
            string title,
            string data)
        {
            // Make this "thread safe"
            lock (BigBadLock)
            {
                try
                {
                    int logid = DebugLog.LogItems.Count;

                    DebugLogItem item = new DebugLogItem(logid, time, source, type, title, data);

                    DebugLog.TryWriteToMemory(item);

                    // If the user wants to save debug output and we haven't disabled, then commit debug logs
                    // to disk as well
                    if (DebugLog.ShouldSaveDebugOutput && DebugLog.DebugLogDiskCommitEnabled)
                    {
                        if (!TryWriteToDisk(item))
                        {
                            // Don't keep trying to write to disk if it fails once
                            DebugLog.DebugLogDiskCommitEnabled = false;
                        }
                    }
                }
                catch (Exception ex)
                {
                    // Write some debug output to help troubleshoot this
                    System.Diagnostics.Debug.WriteLine(
                        "Exception at WriteTraceMessage: \n" +
                        ex.Message);
                }
            }
        }
示例#13
0
        public void Log(DebugLogType logType, string message)
        {
            var log = new DebugLog(message);

            switch (logType)
            {
            case DebugLogType.Basic:
                _debugData.BasicLogs.Add(log);
                break;

            case DebugLogType.Warning:
                _debugData.WarningLogs.Add(log);
                break;

            case DebugLogType.Error:
                _debugData.ErrorLogs.Add(log);
                break;

            default:
                _debugData.ErrorLogs.Add(new DebugLog($"ArgumentOutOfRangeException of type {nameof(logType)}"));
                break;
            }
        }
示例#14
0
    static public void LogToType(DebugLogType _type, params object[] objs)
    {
        string text = "";

        for (int i = 0; i < objs.Length; ++i)
        {
            if (i == 0)
            {
                text += objs[i].ToString();
            }
            else
            {
                text += ", " + objs[i].ToString();
            }
        }

        switch (_type)
        {
        case DebugLogType.Nomal:
            Debug.Log(text);
            //LogString(text);
            break;

        case DebugLogType.Warring:
            Debug.LogWarning(text);
            break;

        case DebugLogType.Error:
            Debug.LogError(text);
            break;

        case DebugLogType.Screen:
            ScreenViewLog(text);
            break;
        }
    }
示例#15
0
        private void ServerConnectors_OnDebugLog(ServerConnectorContext connectorContext, DebugLogType logType, string info)
        {
            var remoteEndPoint = "NA";

            try { remoteEndPoint = connectorContext.Socket.RemoteEndPoint.ToString(); } catch { }

            Console.WriteLine($"ServerConnectors_OnDebugLog RemoteEndPoint:{remoteEndPoint} logType:{logType} info:{info}");
        }
 public void ShowError()
 {
     debugLogType = DebugLogType.Error;
 }
示例#17
0
 public static void Log(DebugLogType type, params object[] objects) => LogInternal(new ObjectsBuffer(objects, type), objects.Length);
 public void ShowLog()
 {
     debugLogType = DebugLogType.Log;
 }
 public void ShowWarning()
 {
     debugLogType = DebugLogType.Warning;
 }
示例#20
0
 private static void ClientConnector_OnDebugLog(DebugLogType logType, string info)
 {
     Console.WriteLine($"ClientConnector_OnDebugLog logType:{logType} info:{info}");
 }
 public void ShowAll()
 {
     debugLogType = DebugLogType.All;
 }
示例#22
0
 public ObjectsBuffer(object[] objects, DebugLogType logType)
 {
     this.objects = objects;
     this.logType = logType;
 }
示例#23
0
 public ObjectsBuffer(int bufferSize, DebugLogType logType) : this(new object[bufferSize], logType)
 {
 }
示例#24
0
 public ObjectsBuffer(ObjectsBuffer buffer, DebugLogType logType) : this(buffer.objects, logType)
 {
 }
示例#25
0
 internal void TriggerOnDebugLog(ServerConnectorContext serverConnectorContext, DebugLogType logType, string info)
 {
     OnDebugLog?.Invoke(serverConnectorContext, logType, info);
 }
示例#26
0
 public void Log(DebugLogType logType, string message)
 {
     _debugLogger.Log(logType, message);
 }