2018-03-29 23:30:56 -04:00
|
|
|
|
using System;
|
2018-03-29 23:46:27 -04:00
|
|
|
|
using System.Collections.Generic;
|
2018-03-29 23:30:56 -04:00
|
|
|
|
using System.Runtime.Serialization;
|
|
|
|
|
|
using Microsoft.Azure.Documents;
|
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
|
using Serilog.Events;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Bit.Admin.Models
|
|
|
|
|
|
{
|
|
|
|
|
|
public class LogModel : Resource
|
|
|
|
|
|
{
|
|
|
|
|
|
public long EventIdHash { get; set; }
|
2018-03-30 08:38:15 -04:00
|
|
|
|
public string Level { get; set; }
|
2018-03-29 23:30:56 -04:00
|
|
|
|
public string Message { get; set; }
|
|
|
|
|
|
public string MessageTruncated => Message.Length > 200 ? $"{Message.Substring(0, 200)}..." : Message;
|
|
|
|
|
|
public string MessageTemplate { get; set; }
|
|
|
|
|
|
public Error Exception { get; set; }
|
2018-03-29 23:46:27 -04:00
|
|
|
|
public IDictionary<string, object> Properties { get; set; }
|
2018-03-30 00:01:53 -04:00
|
|
|
|
public string Project => Properties?.ContainsKey("Project") ?? false ? Properties["Project"].ToString() : null;
|
2018-03-29 23:30:56 -04:00
|
|
|
|
|
|
|
|
|
|
[JsonObject(MemberSerialization.OptIn)]
|
|
|
|
|
|
public class Error : Exception, ISerializable
|
|
|
|
|
|
{
|
|
|
|
|
|
[JsonProperty(PropertyName = "error")]
|
|
|
|
|
|
public string ErrorMessage { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
[JsonConstructor]
|
|
|
|
|
|
public Error() { }
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|