protected override void Initialize() { ModeChanged += OnModeChanged; SLog.SetLogger(OnLog); base.Initialize(); }
/// <summary> /// Unity start. /// </summary> private void Start() { SLog.SetLogger(OnLog); DebugHelper.ActivateConsole(); //use video and audio by default (the UI is toggled on by default as well it will change on click ) config.Video = true; config.Audio = true; }
/// <summary> /// /// Activates a default logger. This can be /// used to monitor the connection process. /// /// You can add your own logger by calling /// SLog.SetLogger(LogHandler); directly instead. /// </summary> public void SetDefaultLogger(bool active, bool verbose = false) { sLogVerbose = verbose; if (active) { SLog.SetLogger(OnLog); } else { SLog.SetLogger(null); } }
protected virtual void Init() { if (uDebugConsole) { DebugHelper.ActivateConsole(); } if (uLog) { if (sLogSet == false) { SLog.SetLogger(OnLog); sLogSet = true; SLog.L("Log active"); } } //This can be used to get the native webrtc log but causes a huge slowdown //only use if not webgl bool nativeWebrtcLog = true; if (nativeWebrtcLog) { #if UNITY_ANDROID //uncomment for debug log via log cat //Byn.Net.Native.NativeWebRtcNetworkFactory.SetNativeLogLevel(WebRtcCSharp.LoggingSeverity.LS_INFO); #elif UNITY_IOS //uncomment for log output via xcode //Byn.Net.Native.NativeWebRtcNetworkFactory.SetNativeLogLevel(WebRtcCSharp.LoggingSeverity.LS_INFO); #elif (!UNITY_WEBGL || UNITY_EDITOR) Byn.Net.Native.NativeWebRtcNetworkFactory.SetNativeLogLevel(WebRtcCSharp.LoggingSeverity.LS_INFO); //Byn.Net.Native.NativeWebRtcNetworkFactory.SetNativeLogToSLog(WebRtcCSharp.LoggingSeverity.LS_INFO); #else //webgl. logging isn't supported here and has to be done via the browser. Debug.LogWarning("Platform doesn't support native webrtc logging."); #endif } if (UnityCallFactory.Instance == null) { Debug.LogError("UnityCallFactory failed to initialize"); } //not yet implemented //CustomUnityVideo.Instance.Register(); }
/// <summary> /// Will route the log messages from the C# side plugin's SLog class to /// the Unity log. This method will only change the log level if /// a more detailed log level is requested than privously. /// This is to allow multiple components that run in parallel to use this /// call without overwriting each others logging. /// /// You could also make sure the log level in this class remains at /// None and instead implement your own logger using the class SLog. /// /// There are some special cases due to platform specific code: /// /// WebGL: The browser plugin code won't log trough the unity logging /// system and instead use the browser API directly. The log level will /// still be changed by this call but it won't use the "OnLog" callback /// /// Native: By default the C++ side won't be logged via Unity as /// Unity can get buggy by triggering callbacks from parallel native /// threads. /// You can activate c++ side logging via the flag NATIVE_VERBOSE_LOG. /// Output of the native log is done based on the platform and /// the OnLog callback is not used. /// (e.g. Xcode debug console, Android LogCat, windows console, ...) /// <param name="requestedLevel">Requested level log level. /// Will be ignored if the current log level is more detailed already. /// </param> /// </summary> public void RequestLogLevel(LogLevel requestedLevel) { if (sActiveLogLevel < requestedLevel) { Debug.Log("Changing log level to " + requestedLevel); if (sActiveLogLevel == LogLevel.None) { //the log level was off completely -> register callback //Do this only once to avoid overwriting a custom logger //that might have been set after this call. SLog.SetLogger(OnLog); } sActiveLogLevel = requestedLevel; } #if UNITY_WEBGL && !UNITY_EDITOR UpdateLogLevel_WebGl(); #endif }
/// <summary> /// Will setup webrtc and create the network object /// </summary> private void Start() { //shows the console on all platforms. for debugging only if (uDebugConsole) { DebugHelper.ActivateConsole(); } if (uLog) { SLog.SetLogger(OnLog); } SLog.LV("Verbose log is active!"); SLog.LD("Debug mode is active"); Append("Setting up WebRtcNetworkFactory"); WebRtcNetworkFactory factory = WebRtcNetworkFactory.Instance; if (factory != null) { Append("WebRtcNetworkFactory created"); } }