Android Investigator


Source link: https://github.com/lemonboston/android-investigator

Android Investigator

A simple tool that can be used to quickly add informative debug logs to the code during investigation without typing much:

@Override public void onResume() {

  Investigator.log(this);

  ... 
}

log:

D/Investigator: [main] [email protected]() 

Features

Easy or automatic logging of the followings at the place of the call:

  • the thread name
  • the !! object instance !! (its toString() value)
  • the method name
  • the stacktrace (for custom method depth)
  • variable values conveniently
  • the time elapsed since a start call
  • an extra comment

Motivation

Android Investigator is not intended as a production logging solution but as a handy productivity tool for helping bugfixing and investigation, kept available on the debug classpath (or even commented out in gradle).
Logging the object instance (not just the class) is the extra that it does compared to other logging libraries. I found it useful in many situations (e.g.: configuration changes, fragment transactions, checking DI scopes, checking activity launchmodes).
It is also simple and convenient to use:

More sample usage

D/Tag: [main] [email protected]()

  <- Investigator.log(this)  D/Tag: [thread-5] [email protected]() | comment

<- Investigator.log(this, "comment")  D/Tag: [main] [email protected]() | age = 32
  <- Investigator.log(this, "age", age)  D/Tag: [main] [email protected]()

<- Investigator.log(this, 3);

  at sample.MyAsyncTask.onPostExecute(MyAsyncTask.java:10)
  at android.os.AsyncTask.finish(AsyncTask.java:651)
  at android.os.AsyncTask.-wrap1(AsyncTask.java)  D/Tag: [main] [email protected]() | 0 ms (STOPWATCH STARTED) <- Investigator.startStopWatch(this);
 D/Tag: [main] [email protected]() | 344 ms
  <- Investigator.log(this);
 

Tag, default stacktrace method depth, thread name, and log level are customizable through the fields of the class. (Check out the class itself or the javadoc.)

When is it useful?

It can be most useful when debugging is not effective any more because there are too many checkpoints to step through or there is asynchronicity. Adding a few simple Investigator log calls to checkpoints can provide an overview about the order of the events, the object instances in play, variable values, where the watched method is called from, and on which thread. (I also found myself using it instead of simple debugging, too.)

Note: The log calls complete fast (usually under 1 ms) so they don't distort the normal program flow.

Download

Android Investigator is available in Maven Central.

Get with gradle:

dependencies {

  debugCompile 'com.github.lemonboston:android-investigator:1.0.0' 
}
 

Or, since it is a single java class, it can be grabbed from here and added to the project (possibly under src/debug/java).

License

MIT License - Copyright (c) 2016 Gabor Keszthelyi

Resources

Android library designed for rapid and customizable form validation.

You can use FormValidator with any View that extends the original EditText (such as MaterialEditText for example).

This library offers an easy way to handle authentication and encryption using Android Fingerprint APIs.

A utility library that does the following type of validations:

  • Check internet connection
  • Validate for empty edit texts
  • Validate for email
  • Validate for mobile number
  • Validate text for any no of digits
  • Fancy Progress Dialog
  • Toast

CircularView is a simple library that aims to replicate Google Fit's circular view implementation and adding a few new features such as timer and population animation

CarouselEffect with ViewPager.

A Retrofit2 converter which parses Rss feeds.

Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes