Scribo


Source link: https://github.com/sasneeBlr/scribo

Scribo

A simple easy-to-use debug utility which helps you capture the logs simultaneously to adb terminal as well to a file on SD Card.

Table of Contents

  1. [Gradle Dependency] ( https://github.com/sasneeBlr/scribo#gradle-dependency-jcenter)
  2. [Features] ( https://github.com/sasneeBlr/scribo#features)
  3. [Usage] ( https://github.com/sasneeBlr/scribo#usage)

Gradle Dependency (jCenter)

Easily reference the library in your Android projects using this dependency in your module's build.gradle file:

dependencies {

  compile 'com.sasnee.scribo:scribo:1.2.0' 
}

Features

Scribo allows capturing the debug logs of any android application into a file on external storage in addition to displaying it on the adb terminal. This is ideal to capture logs of the application once it is deployed in the field. The captured logs are stored in the external storage directory under the path: <External Storage>/AppData/<application_name>/
(For eg: /storage/emulated/0/AppData/com.sasnee.scribosample/)

Log Masks

Scribo supports 10 categories of log masks by default. This is useful to categorize logs from individual modules of the application and enable/disable them individually. Scribo also supports setting custom strings to identify these default log categories.
For eg: "UI Module" can be mapped to Category 1, "Display Module" can be mapped to Category 2 and so on. Once this is done, the logs belonging to these categories can be dynamically enabled/disabled.

ADB Logging

Scribo can be configured to disable printing the logs on adb terminal and instead only send it to the file. This might be needed in certain scenarios to enhance performance of the application.

Retrieve Log File

Starting v1.2.0, scribo provides with an option to easily retrieve the log file from the device. This new API can be used to send the log file containing the debug logs to be sent from the device. When this API is invoked, user gets a list of services that can be used to send the log file from the device. (Bluetooth, Email, ShareIT etc). If the intention is to email the log file, scribo exposes an API to prepopulate the list of people to whom the email needs to be sent.


Usage

  • First, initialize scribo by invoking any of the below init() functions:
 DebugHelper.init(Context)  DebugHelper.init(Context, fileName)  DebugHelper.init(Context, fileName, resetFileContents)

Example:

 DebugHelper.init(this);
  // Logs are captured into file "logJournal.txt".  // File contents are reset everytime the application is invoked.
 DebugHelper.init(this, "CapturedLogs.txt");
  // Logs are captured into file "CapturedLogs.txt".  // File contents are reset everytime the application is invoked.
 DebugHelper.init(this, "CapturedLogs.txt", false);

// Logs are captured into file "CapturedLogs.txt".  // File contents are NOT reset everytime the application is invoked.

Please note the init() function needs to be invoked from the main activity of the application.

  • Override the log mask supported by scribo with a custom log mask. (This is optional)
 DebugHelper.mapCustomLogMask(<Default Category>, <Override String>);

Example:

 DebugHelper.mapCustomLogMask(DebugHelper.LOG_CATEGORY_0, "UI Module");

// Map Category 0 to "UI Module"
 DebugHelper.mapCustomLogMask(DebugHelper.LOG_CATEGORY_4, "URL Loader Module");

// Map Category 4 to "URL Loader Module"
  • Enable/Disable the log categories.
 DebugHelper.enableDisableLogCategory(category, isEnable);
 

Example:

 DebugHelper.enableDisableLogCategory(DebugHelper.LOG_CATEGORY_1, true);
  // Enable Category 1 logs.
 DebugHelper.enableDisableLogCategory("UI Module", false);
  // Disable "UI Module" logs.
  • Send log request to scribo
 DebugHelper.logRequest(<TAG>, <Log Message>, <Show on ADB Logs>, <Severity>, <Category>);
  // <TAG> and <Log Message> arguments are mandatory.   // <Show on ADB Logs>, <Severity> and <Category> are optional.   // If <Show on ADB Logs> is not provided, it defaults to true, i.e the log will be shown on ADB terminal.  // If <Severity> is not provided, it defaults to SEVERITY_LEVEL_VERBOSE.  // If <Category> is not provided, it defaults to LOG_CATEGORY_GENERAL.

Example:

 DebugHelper.logRequest(TAG, "Log message");
 DebugHelper.logRequest(TAG, "Log message", false);
  // Do not display this log on the ADB terminal.
 DebugHelper.logRequest(TAG, "Log message", DebugHelper.SEVERITY_LEVEL_ERROR);
 DebugHelper.logRequest(TAG, "Log message", DebugHelper.LOG_CATEGORY_1);
 DebugHelper.logRequest(TAG, "Log message", false, DebugHelper.SEVERITY_LEVEL_WARN, DebugHelper.LOG_CATEGORY_1);
  • Email the log file.
 DebugHelper.sendLogFileByEmail();

  // Do not prepopulate the "To" field of the email. 
  // Enter the email IDs manually before sending the log file.
 DebugHelper.sendLogFileByEmail(List<String> emailList);

  // Prepopulate the "To" field of the email with the list of emailIDs mentioned in emailList.
  // This saves some effort in case the log file is always meant to be sent to same list of people.

Resources

Battery Historian is a tool to analyze battery consumers using Android "bugreport" files.

A Java library for the Forecast.io API. It is quite functional at this point. The API is fully implemented except for callbacks. Further development will continue. A jar file with the dependencies is available under the jar/ folder for convenience.

Fontain is a lightweight library for displaying text in custom fonts in your Android applications

Fontain allows you to include a number of custom fonts within your app, and then access them by their Font Family, Weight, Width and Slope. It simplifies the process of selecting the proper typeface for any given usage.

EtsyBlur is an Android library that allows developers to easily add a glass-like effect.

ExpandableTextView is an Android library that allows developers to easily create an TextView which can expand/collapse just like the Google Play's app description.

IntelliJ / Android Studio plugin for Android Holo Colors.

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