/// <summary> /// New Instance of Log Model /// </summary> /// <param name="obj"> /// Can be an Exception or any object (will be serialize to Json String and store in Message property) /// </param> /// <param name="httpContext">HttpContext of current request if have</param> public LogModel(object obj, HttpContext httpContext = null) { if (obj is Exception exception) { Initial(exception); } else { Message = obj.ToJsonString(); } CreatedTime = DateTimeOffset.UtcNow; Type = LogType.Error; Runtime = RuntimeHelper.Get(); EnvironmentModel = EnvironmentHelper.Get(); Sdk = SdkHelper.Get(Assembly.GetCallingAssembly().GetName()); if (httpContext != null) { HttpContext = new HttpContextModel(httpContext) { Id = Id.ToString("N") }; } }
public RPCInterceptor(HttpContextModel httpContextModel) { this._httpContextModel = httpContextModel; }