Aardvark: Your Logs Slurped, Your Bugs Licked

Aardvark: Your Logs Slurped, Your Bugs Licked

An iOS library that delivers timely and actionable bug reports

Written by Dan Federman.

The dreaded email

We’ve all experienced the frustration of getting a bug report and not having enough information to track it down. The email hits your inbox: “Hey, I tried to do X and it didn’t work.” There’s no build number, no screenshot, and no explanation of what “tried” or “didn’t work” actually mean. You know you have a bug, but you don’t have what you need to track it down. You desperately email the reporter seeking the information you need. Maybe you even send them instructions for how to import console logs from their device. By the time they get back to you, they’ve already updated their build, their logs have already rolled over, and they have no idea how to reproduce what they saw.

It’s hard to file a good bug. Nobody’s memory is perfect–and a person who takes the time to report a bug is only going to take so much time out of their day to let you know how you screwed up. So let’s take the burden off the tester.

Enter Aardvark

Aardvark is a comprehensive logging system that makes it extremely easy to log every event in your app and get those logs off of a device at the moment you need them: when the bug is filed. When someone sees something go wrong, all they need to do is press and hold with two fingers. Aardvark takes a screenshot, asks the customer what went wrong, and then generates an email bug report with your logs and the screenshot attached. Now you have an actionable bug report.

There’s also a log viewer built into Aardvark, so you can view the logs directly on the device without having to compose an email. When you’re working in the simulator, you can export logs to a file or print to console. When you’re working on device, you’ve got Airdrop at your disposal.

Better yet, Aardvark is a cinch to hook into your app. Start logging to Aardvark by replacing all of your NSLog calls with ARKLog. Then set up bug reporting with a single line of code. That’s it!

Log once, send it everywhere

Aardvark is more than just a bug filing tool–it’s capable of managing all your logging needs. If you use logging not only to help track down bugs, but also to track how customers interact with your apps (and to learn what a customer was doing right before a crash happened), you can use Aardvark to send these logs out to other services.

How? When you call ARKLog, Aardvark shoots that log off to a Log Distributor, which then notifies each of its Log Observers about the message. Each Log Observer then consumes the log and makes sure it goes where it needs to. Want to forward your logs to Crashlytics (the awesome crash reporting tool that Square uses)? With Aardvark, you can do so with just 10 lines of code. Just add a log observer to the default log distributor that calls CLSLog when it receives a message.

Always be logging

Remember that time you put too many NSLog statements into your app, and it slowed to a crawl? That won’t happen with ARKLog. There’s only one piece of work that Aardvark will do on the queue that calls it: construct the format strings you send it. Once the string is constructed, Aardvark asynchronously dispatches the string to a serial background queue for processing. Worried about all those logs eating up memory? Don’t be. Aardvark’s ARKLogStore utilizes a background queue to serialize the logs directly to disk. It even manages keeping the log file size to a minimum for you. It pulls logs into memory only when a bug is filed.


We hope Aardvark is as useful to you as it is to us, and we hope you contribute back any improvements you make!

This post is part of Square’s “Week of iOS” series. Dan Federman *Follow the latest activity of Dan Federman on Medium. 57 people are following Dan Federman to see their stories and…*medium.com

Table Of Contents