API v2 Released
Time for an update on our v2 API which we released in beta last year. The new API have been available for the last three months through the website and a prerelease NuGet package. This week we finished all the missing pieces for the new API to go out of beta.
Like discussed in the beta announcement, the v2 API is not bound to neither ELMAH nor the error XML format inside ELMAH. So this may not affect you if you’re using elmah.io to log un-catched exceptions from your website, but it definitely gives you some new possibilities listed below.
We have been working on improving message severities on elmah.io for the last couple of months. ELMAH natively doesn’t contain the concept of a severity or level known from other logging frameworks like log4net and Serilog. The elmah.io client now have fully support for 6 levels of severities: Verbose, Debug, Information, Warning, Error and Fatal. When logging errors through elmah.io’s ErrorLog implementation for ELMAH, we assign a severity to the error, based on the status code. If you are logging to elmah.io manually (see below), you have the option of assigning a severity to each message.
There’s a new NuGet package in town. elmah.io previously provided two NuGet packages for hooking up error handling to your website: elmah.io and elmah.io.core. While elmah.io.core contained the ErrorLog implementation, as well as the code for communicating with elmah.io’s API, the elmah.io package contained the web.config changes only. The 2.0 client still contains the two existing packages, but elmah.io.core have been split into core and client (elmah.io.client). The client contains the code for communicating with the new API and contains a nice logging interface inspired by popular logging frameworks like log4net. You can create a new logger and start logging messages to elmah.io, without changing a single line of code in your web.config and you can even log messages from console, wpf and other kinds of apps:
var logger = Logger.Create(new Guid("LOG_ID")); logger.Error(new ApplicationException(), "Message attached the error"); logger.Information("Some kind of information message");
LOG_ID with your log ID)
Michiel van Oudheusden wrote an integration to elmah.io from the popular logging framework Serilog last year. Because elmah.io only supported errors in the past, the match where not perfect. After releasing the v2 API, we’ve had the possibility to redo everything inside the elmah.io sink for Serilog, making the two tools new best friends. With the new sink, you can log messages of all Serilog levels to elmah.io, using recognizable code like this:
Log.Logger = new LoggerConfiguration() .MinimumLevel.Verbose() .WriteTo.ElmahIO(new Guid("LOG_ID")) .CreateLogger(); Log.Information("This in an info message"); Log.Verbose("This in a verbose message"); Log.Fatal(new SystemException(), "This is a fatal message");
LOG_ID with your log ID)
We hope that making it way easier to integrate with elmah.io, will give birth to some interesting new use cases. In fact we are giving away 6 month of free subscriptions to anyone creating a cool integration to elmah.io. Please get in touch if you have created an integration for elmah.io. We are already seeing integrations for different logging frameworks like Serilog and Logary, but only time will show what you come up with. We believe in open API’s and open source, why everything related to our new client is available at GitHub. Also check out our updated examples on how to integrate with elmah.io on different levels.
elmah.io: Error logging and Uptime Monitoring for your web apps