namespace decePubClient.Models
{
public class ClientLogs
{
public long Id { get; set; }
public string Where { get; set; }
public string WarningMessage { get; set; }
public ClientLogException Exception { get; set; }
public DateTime TimeStamp { get; set; } = DateTime.Now;
/// The entry as HTML for a log viewer: the warning text, or the exception's details.
public string ErrorMessage()
{
if (Exception is null)
return WarningMessage;
var details = @$"Type: {Exception.Type ?? "N/A"} HelpLink: {Exception.HelpLink ?? "N/A"} HResult: {Exception.HResult ?? "N/A"}
Source: {Exception.Source ?? "N/A"} StackTrace: {Exception.StackTrace ?? "N/A"} MemberName: {Exception.TargetSiteName ?? "N/A"}
Message: {Exception.Message ?? "N/A"}";
if (Exception.InnerExceptionMessage is null)
return details;
return $"{details}
\nInnerExceptionMessage:{Exception.InnerExceptionMessage}";
}
}
public class ClientLogException
{
public string Type { get; set; }
public string HelpLink { get; set; }
public string HResult { get; set; }
public string Source { get; set; }
public string StackTrace { get; set; }
public string TargetSiteName { get; set; }
public string Message { get; set; }
public string InnerExceptionMessage { get; set; }
}
}