Recently I’ve been playing round with a few libraries that people share based upon an api or service that they offer. These libraries offer access to data in a controlled way and more often than not require authorisation to use.
When I’ve picked up the library I just want to start coding straight away and I don’t think about the authorisation or giving an api key, but then when I’ve written some code and run my app .. nothing, it doesn’t work. This is usually down to a missing api key or some other simple command that I’ve missed. Searching the logs for what seems like hours there is a tiny single line saying something like “unknown api key”.
So I thought hey! Wouldn’t it be great if these libraries could inform you of the correct use in a more prominent, louder way. What if the whole LogCat window was dedicated to saying “DUH YOU DIDN’T ADD THE API KEY – I NO WORK FOR YOU”.
Introducing ArrowLog your friendly, obnoxious LogCat spammer. ArrowLog isn’t for everyone you wouldn’t want every message logged this way so please use some common sense & ship it with all your apps.
Simple api use is like so:
ArrowLog.log("Spamming your LogCat YOLO");
Which results in the awesomeness:
If you want to get down and dirty and really take pleasure in how you spam LogCat you can have more control with the ProArrowLog:
ProArrowLog.pal() .width(5) .height(8) .level(E) .log("Giant Arrows in yo face!") .now();
The creates a log with 6 arrows that are 8 characters tall, logging with Log.e:
Disclaimer: ProArrowLog is only for pro’s if the arrows don’t come out as you expect: you’re doing it wrong
ArrowLog is available now from JCenter (that’s the default repository for Android apps).
You can add it to your project like so
repositories { jcenter() } dependencies { compile 'com.blundell:arrow-log:1.1.0' }
ArrowLogger is open source and available here for your forking pleasure.
For contributors, a little about the code? ArrowLogger is split into two modules, one is pure java and the other Android. The arrow-logger (Android) module only looks after printing by LogCat and has the user facing api. The arrow-core (Java) module is where the magic happens, checkout ArrowMessageWrapper.java to see how the arrows are generated, they are calculated line by line and added to a list of logs.
Pull requests for new logging shapes like squares, spears & shamrocks are more than welcome!
Really? LOL are you planning to push this into notils?
haha I didn’t think it was NoTils material