protected virtual void LogPackage <T>(PPPokerPackage package)
        {
            try
            {
                if (package.PackageType == PackageType.HeartBeatREQ || package.PackageType == PackageType.HeartBeatRSP)
                {
                    return;
                }

#if DEBUG
                if (!SerializationHelper.TryDeserialize(package.Body, out T packageContent))
                {
                    LogProvider.Log.Warn(this, $"Failed to deserialize {typeof(T)} package");
                }

                var packageJson = new PackageJson <T>
                {
                    PackageType = package.PackageType,
                    Direction   = package.Direction,
                    ClientPort  = package.ClientPort,
                    Content     = packageContent,
                    Time        = package.Timestamp
                };

                var json = JsonConvert.SerializeObject(packageJson, Formatting.Indented, new StringEnumConverter());

                protectedLogger.Log(json);
#else
                using (var ms = new MemoryStream())
                {
                    Serializer.Serialize(ms, package);
                    var packageBytes = ms.ToArray();

                    var logText = Encoding.UTF8.GetString(packageBytes);
                    protectedLogger.Log(logText);
                }
#endif
            }
            catch (Exception e)
            {
                LogProvider.Log.Error(this, "Failed to log package", e);
            }
        }