public sealed override void OnException(HttpActionExecutedContext context) { if (OnLogging != null) { OnLogging.Invoke(this, new LogEventArgs() { Exception = context.Exception, Request = context.Request }); } context.Response = new HttpResponseMessage(GetHttpStatusCode(context.Exception)); context.Response.Content = new StringContent(ConvertToDataContract(GetUnhandledErrorInfoObject(context.Request, context.Exception)), UTF8WithoutBom, "application/json"); }
public void Success(string message) { OnLogging?.Invoke(this, new LogEventArgs(message, MessageType.OK)); }
public void Error(string message) { OnLogging?.Invoke(this, new LogEventArgs(message, MessageType.ERROR)); }
public void Log(string message, MessageType type = MessageType.REGULAR) { OnLogging?.Invoke(this, new LogEventArgs(message, type)); }
/// <summary> /// This method raises an event. /// </summary> /// <param name="text">Text to be written in the file.</param> protected void LogAction(string text) { OnLogging = Action; OnLogging?.Invoke(text); }