Ejemplo n.º 1
0
        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");
        }
Ejemplo n.º 2
0
 public void Success(string message)
 {
     OnLogging?.Invoke(this, new LogEventArgs(message, MessageType.OK));
 }
Ejemplo n.º 3
0
 public void Error(string message)
 {
     OnLogging?.Invoke(this, new LogEventArgs(message, MessageType.ERROR));
 }
Ejemplo n.º 4
0
 public void Log(string message, MessageType type = MessageType.REGULAR)
 {
     OnLogging?.Invoke(this, new LogEventArgs(message, type));
 }
Ejemplo n.º 5
0
 /// <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);
 }