public Task <HttpResponseMessage> ProduceLogs() { return(Storytelling.Factory.StartNewAsync("ProduceLogs", async() => { var str = await _fooService.GetRandomString(); Storytelling.Debug("This is a debug message {0}", str); str = await _fooService.GetRandomString(); Storytelling.Info("This is a information message {0}", str); str = await _fooService.GetRandomString(); Storytelling.Warn("This is a warning message {0}", str); return Request.CreateResponse(HttpStatusCode.Created, "logs created"); })); }
public override void OnException(HttpActionExecutedContext context) { Storytelling.Warn("Internal error - " + context.Exception); var message = context.Exception.Message; var httpStatusCode = HttpStatusCode.InternalServerError; Storytelling.Data["responseMessage"] = message; var resp = new HttpResponseMessage() { Content = new StringContent(message) }; resp.StatusCode = httpStatusCode; context.Response = resp; base.OnException(context); }