SwiftyBeaver on Linux

Already before the official release of Swift 3 in September 2016, the work on porting SwiftyBeaver from Swift 2 to Swift 3 had started. On release day of Swift 3, SwiftyBeaver’s porting to Swift 3 was finished and celebrated with the new major version tag 1.0

Swift 3 was built to support Linux out-of-the box and so we thought that making SwiftyBeaver work under Linux would be a piece of cake. But that was wrong.

The porting took nearly a month.

Parts of Swift’s Foundation library were still more or less centered around being run on the Apple platform and under Linux certain functionalities simply were not implemented, yet. Additionally, some basic functions like arc4_random() to generate random numbers (which is important in SwiftyBeavers end-to-end encryption component) just were not existing under Linux at all.

The solution for generating random numbers under Linux was a new wrapper which is using the operating system’s own /dev/urandom CLI command. That wrapper and many improvements also found their way in our dedicated AES256CBC encryption framework which is also embedded in SwiftyBeaver itself.

In total, the porting of SwiftyBeaver to server-side Swift took nearly a month and 2 additional open-source projects spun off the process, too: our logging provider for Vapor and the website ported to server-side Swift.