123456789101112131415161718192021222324252627282930313233 |
- using XGame.Framework.Utils;
- namespace XGame.Framework.Network
- {
- public static class NetLog
- {
- public static bool isVerbose = true;
- /// <summary>
- /// 比Debug更详细的log
- /// </summary>
- /// <param name="str"></param>
- [System.Diagnostics.Conditional(MacroDefine.DEBUG)]
- public static void LogVerbose(string str)
- {
- if (isVerbose)
- {
- Log.Debug($"<color=#00FF00>[Net] {str}</color>");
- }
- }
- [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($"<color=#00FF00>[Net] {str_prefix} {sb}</color>");
- StringBuilderUtils.Release(sb);
- }
- }
- }
- }
|