using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class SBLogger { private static bool debug = true; private string tag; public SBLogger(string tag) { this.tag = "[" + tag + "]"; } public void Log(object info) { if (!debug) return; JC.Unity.CoroutineStarter.Start(SendToServer(0, info)); } public void Warn(object info) { if (!debug) return; JC.Unity.CoroutineStarter.Start(SendToServer(1, info)); } public void Error(object info) { if (!debug) return; JC.Unity.CoroutineStarter.Start(SendToServer(2, info)); } IEnumerator SendToServer(int level, object info) { long time = JC.CS.Utility.GetTimestamp(); string txt = this.tag + " " + info; yield return null; if (level == 0) Debug.Log(txt); else if (level == 1) Debug.LogWarning(txt); else if (level == 2) Debug.LogError(txt); int uid = LoginMgr.myUserInfo.id; if (uid > 0) { UserPlayer.ins?.call("sbLog", uid, time, tag, info.ToString()); } } }