Last active
August 29, 2015 14:16
-
-
Save AlbertoMonteiro/8c11af6cb65f775e42d4 to your computer and use it in GitHub Desktop.
Rollbar
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| filters.Add(new RollbarMvcExceptionFilter()); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| kernel.BindFilter(FilterScope.Global, 10).InSingletonScope(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class RollbarMvcExceptionFilter : IExceptionFilter | |
| { | |
| RollbarClient client = new RollbarClient(); | |
| public void OnException(ExceptionContext filterContext) | |
| { | |
| if (filterContext.ExceptionHandled) | |
| return; | |
| client.SendException(filterContext.Exception); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class RollbarWebApiExceptionFilter : IExceptionFilter | |
| { | |
| RollbarClient client = new RollbarClient(); | |
| public bool AllowMultiple | |
| { | |
| get { return false; } | |
| } | |
| public async Task ExecuteExceptionFilterAsync(HttpActionExecutedContext context, CancellationToken cancelToken) | |
| { | |
| await Task.Factory.StartNew(() => client.SendException(context.Exception), cancelToken); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <configuration> | |
| <appSettings> | |
| <add key="Rollbar.AccessToken" value="YOUR_TOKEN_HERE"/> | |
| <add key="Rollbar.Environment" value="developement"/> | |
| </appSettings> | |
| </configuration> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <configuration> | |
| <appSettings> | |
| <add key="Rollbar.Environment" value="production" xdt:Transform="SetAttributes" xdt:Locator="Match(key)"/> | |
| </appSettings> | |
| </configuration> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| config.Filters.Add(new RollbarWebApiExceptionFilter()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment