Color Mode


    Language

Bugsnag for Vapor 3

January 31, 2019

At Nodes we have been working hard on a Vapor 3 provider for Bugsnag. Bugsnag is a reporting tool that we use extensively to help catch and fix bugs.

In the new version of the library, we've been able to remove a lot of dead code, simplify the API and add support for breadcrumbs.

Migration to Vapor 3

The migration from Vapor 2 to Vapor 3 was a relatively easy one for Bugsnag. The major changes were the use of Codable and the introduction of Futures.

One of the double-edged-swords of Vapor 3 is the asynchronous design. The asynchronous nature of the framework makes stack traces virtually useless. Sadly, we had to remove support for Stack and stack traces.

Registration has seen an update as well. It now uses the Service system.

let reporter = BugsnagReporter(
    apiKey: "<YOUR BUGSNAG API KEY>",
    releaseStage: environment.name,
    shouldReport: environment.name != "local"
    debug: false
)

With a newly simplified API, we introduced support for severities.

reporter.info(...)
reporter.warning(...)
reporter.error(...)

After the migration to Vapor 3, we updated the Bugsnag payload version from 2 to 4. This allows us to support newer features as well as silence warnings about deprecated APIs.

Breadcrumbs

After many feature requests, we have now integrated breadcrumbs into the latest version. Breadcrumb is a feature that helps ease the debugging process by enabling a user to attach data to the life-cycle of a request. To drop a breadcrumb just use the convenience function on Request.

 req.breadcrumb(
     name: "Something happened!",
     type: .manual,
     metadata: ["foo": "bar"]
 )

If you are curious about Bugsnag and would like to know more or try it out, be sure to checkout the repo on Github.

Article Photo by Andrew Neel

serverbugsnagreportreportingrelease

Author

Brett R. Toomey

Brett R. Toomey

Vapor & iOS Developer

Using Swift to take over the world.

You may also like

November 7, 2024

Introducing Shorebird, code push service for Flutter apps

Update Flutter apps without store review What is Shorebird? Shorebird is a service that allows Flutter apps to be updated directly at runtime. Removing the need to build and submit a new app version to Apple Store Connect or Play Console for review for ev...

Christofer Henriksson

Christofer Henriksson

Flutter

May 27, 2024

Introducing UCL Max AltPlay, a turn-by-turn real-time Football simulation

At this year's MonstarHacks, our goal was to elevate the sports experience to the next level with cutting-edge AI and machine learning technologies. With that in mind, we designed a unique solution for football fans that will open up new dimensions for wa...

Rayhan NabiRokon UddinArman Morshed

Rayhan Nabi, Rokon Uddin, Arman Morshed

MonstarHacks

ServicesCasesAbout Us
CareersThought LeadershipContact
© 2022 Monstarlab
Information Security PolicyPrivacy PolicyTerms of Service