using XGame.Framework.Utils; namespace XGame.Framework.Network { public static class NetLog { public static bool isVerbose = true; /// /// 比Debug更详细的log /// /// [System.Diagnostics.Conditional(MacroDefine.DEBUG)] public static void LogVerbose(string str) { if (isVerbose) { Log.Debug($"[Net] {str}"); } } [System.Diagnostics.Conditional(MacroDefine.DEBUG)] public static void LogHexString(string str_prefix, byte[] buffer, int offset, int length) { if (isVerbose) { var sb = StringBuilderUtils.Acquire(); for (var i = offset; i < length + offset; i++) sb.Append(buffer[i].ToString("X2")); Log.Debug($"[Net] {str_prefix} {sb}"); StringBuilderUtils.Release(sb); } } } }