SwiftyBeaver Platform Destination: Log to the cloud

In this lesson

In this lesson, I will introduce you to the SwiftyBeaver platform destination so that you can log to the cloud. Why would you want to log to the cloud? When your apps are running on the devices of those whom have downloaded, it is helpful to be able to easily view logs so you can quickly see if there are problems in the app.

Transcript

Tap on time to skip ahead

00:11

Hello everyone! In this lesson I’m going to introduce you to another log destination that you can log to with SwiftyBeaver and that’s the SwiftyBeaver platform destination. And it’s probably coolest feature of SwiftyBeaver.

00:28

Here I’m running the SwiftyBeaver Mac app. It displays logged messages in this cool, colorful. neat SwiftyBeaver way and there’ll be more on this… much more on this in other lessons. Let’s see how we can add a destination to our application so that we can get the same thing.

00:48

I’m back in the AppDelegate of my application. This is where I configured my destinations, configured my logger. And down here in the initializeLogger() function, I’m going to add a SwiftyBeaver platform destination. I’m just going to paste in some code that I wrote before, just to save a little bit of time. addSwiftyBeaverPlatformDestination(), and what we’ll notice here is that I’m creating this SBPlatformDestination instance. And I have to pass that an appID, a secret and an encryption key and all this comes from registering your application in the Mac app and I’ll cover that in another lesson. But you’ll get an appID, a secret and an encryption key and when you construct the destination you’ll just need to pass those values in. I’m specifying a level of .Info or greater because I don’t want to log at a debug or a verbose level to the platform. I’m just specifying analytics username of my brax.tv email address and I’ll cover that later as well. And then like all the other destinations, I simply add that destination to the logger. When I run my application, anything .Info or greater will go to the SwiftyBeaver platform.

02:13

So where is this exactly? Using the SwiftyBeaver platform destination, your log messages are stored in the cloud. Now you’ll notice that when you pass this encryption key, this is what SwiftyBeaver uses locally to encrypt your log data before it sends it over the network and stores remotely on the SwiftyBeaver platform. Therefore it’s safe and it allows you only to decrypt this with the key that you’ve gotten back from SwiftyBeaver when you register your application.

02:49

With this Mac app, I can query the remote SwiftyBeaver platform for the application that I’m logged in as and look at my messages that have been logged there. I can do this from anywhere that I install this application and it’s really cool, I’ll go into this in greater detail elsewhere, you’ll notice that I did not log in the .Verbose or .Debug level. Instead just the .Info or .Warning and I can quickly look at anything in those levels. So as simple as that, I can add a third remote cloud-based platform logging destination to my applications. And this is a cool feature of SwiftyBeaver.