public void Log(string level, string module, string message) { int levelIndex; for (levelIndex = 0; levelIndex < levelCount && levels[levelIndex] != level; levelIndex++) { } var color = colors[levelIndex]; var time = DateTime.Now.ToString("HH:mm:ss.fff"); var logLine = $"<color={color}>{level}</color> {time} [{module}] {message}"; if (levelIndex >= consoleLevelIndex) { Debug.Log(logLine); } if (!initialized) { return; } for (int i = 0; i < relayTargetCount; i++) { if (levelIndex <= relayLevelIndices[i] && relayTargets[i]) { relayTargets[i].Log(level, module, name); } } if (levelIndex >= relayToGlobalLoggerLevelIndex) { globalLogger.Log(level, module, message); } if (levelIndex < textLevelIndex) { return; } AppendLine(logLine); var lines = logs.Split('\n'); if (lines.Length > maxLines) { logs = ""; for (int i = lines.Length - maxLines; i < lines.Length; i++) { AppendLine(lines[i]); } } if (text != null) { text.text = logs; } }
private void Log(string level, string message) { if (logger != null) { logger.Log(level, $"{gameObject.name} ({Networking.GetOwner(gameObject).displayName})", message); } else { Debug.Log($"{level} [{gameObject.name} ({Networking.GetOwner(gameObject).displayName})] {message}"); } }
private void Log(string level, string message) { if (logger != null) { logger.Log(level, gameObject.name, message); } else { Debug.Log($"{level} [{gameObject.name}] {message}"); } }
private void Log(string level, string message) { if (logger == null && useGlobalLogger) { logger = GameObject.Find("_USV_Global_Logger_").GetComponent <UdonLogger>(); } if (logger != null) { logger.Log(level, gameObject.name, message); } else { Debug.Log($"{level} [{gameObject.name}] {message}"); } }