This commit is contained in:
2020-01-28 20:58:04 +00:00
parent fa1ba3fc28
commit 58241cd68d
2 changed files with 47 additions and 1 deletions

View File

@@ -484,7 +484,7 @@ namespace AyaNova
_newLog.LogInformation($"BOOT: Active techs - {UserBiz.ActiveCountAsync().Result}");
//Log the license info so it's on the record
_newLog.LogInformation($"BOOT: License -\r\n=-=-=-=-=-=-=-=-=-=-\r\n{AyaNova.Core.License.LicenseInfo}=-=-=-=-=-=-=-=-=-=-");
_newLog.LogInformation($"BOOT: License {AyaNova.Core.License.LicenseInfoLogFormat}");

View File

@@ -280,6 +280,52 @@ namespace AyaNova.Core
}
/// <summary>
/// Fetch a summary of the license key for displaying in the log
/// </summary>
/// <returns> string containing current license information</returns>
internal static string LicenseInfoLogFormat
{
get
{
StringBuilder sb = new StringBuilder();
if (ActiveKey.IsEmpty)
{
return $"UNLICENSED, DB ID: {DbId}";
}
else
{
if (ActiveKey.TrialLicense)
sb.Append("TRIAL, ");
sb.Append($"regto: {ActiveKey.RegisteredTo}, ");
sb.Append($"keyid: {ActiveKey.Id}, ");
sb.Append($"dbid: {DbId}, ");
sb.Append($"type: {(ActiveKey.RentalLicense ? "service" : "perpetual")}, ");
if (ActiveKey.WillExpire)
sb.Append($"exp: {DateUtil.ServerDateTimeString(ActiveKey.LicenseExpiration)}, ");
sb.Append($"maint. sub. exps: {DateUtil.ServerDateTimeString(ActiveKey.MaintenanceExpiration)}, ");
sb.Append("feat:");
foreach (LicenseFeature l in ActiveKey.Features)
{
//don't show the rental or trial features
if (l.Feature != TRIAL_FEATURE_NAME && l.Feature != RENTAL_FEATURE_NAME)
{
if (l.Count != 0)
sb.Append($"{l.Feature} - {l.Count}, ");
else
sb.Append($"{l.Feature}, ");
}
}
}
return sb.ToString();
}
}
/// <summary>
/// Fetch a summary of the license key for displaying to the end user
/// via the API