FSLogger


Source link: https://github.com/omegasoft7/FSLogger

FSLogger

An Android Logger with a lot of options for debugging that helps a lot to developers. You can easily add logs everywhere in your APP and manage showing them by limit them by Codes or by their Class name. It also will show you that logs was called from which file and which line, you also can see which class and which line called your current method.

Gradle:

compile 'com.github.omegasoft7.FSLogger:fslogger:1.9.1'

##Iniatialization: for initialization you just need to add following line into your Application class.

//initialize FSLogger FSLogger.init("MyAwesomeAPP");

##Types of Limitation: -)You can set different types for make limitation of showing logs.

  • Class --> Show logs of added class only.
  • Code --> Show logs of added Codes only. For this type you have to use logout(int code, String message). Other types of logs will not show in this type.
  • ALL --> This type is exactly the same with "Code" but the only difference is that it will also check added Class too. If your sender class is not added it will not show any log.
  • ALLOR --> In this type it will check both Code and Class codes and if on of them was true it will show the code
  • NONE --> Do not show any log
  • NOLimit --> Show all logs

You can set your type like following in your Application class:

FSLogger.setType(FSLogger.FSLoggerLimitationType.NOLimit);

##Usage: You have different options to use it.

  • Simple: With a simple message
FSLogger.logout("your log message");  //Result: //[MainActivity.onClick()-336]: your log message
  • Without Message: To track lines of code. you don't need to specify any text for that.
FSLogger.logout();
  //Result: //[MainActivity.onClick()-336]:
  • Without Message with Code: To track lines of code. you don't need to specify any text for that. Specify a code for your log. If you add this code into FSLogger it will show logs with this code otherwise it will just ignore them
//Specify code in Application class like: //FSLogger.addCode(12); FSLogger.logout(12);  //Result: //[MainActivity.onClick()-336]:
  • With Code: Specify a code for your log. If you add this code into FSLogger it will show logs with this code otherwise it will just ignore them.
//Specify code in Application class like: //FSLogger.addCode(12);  FSLogger.logout(12);  //Result: //[MainActivity.onClick()-336]:

##Log Levels: You have a few options for logging

  • FSLogger.logout(); == Debug
  • FSLogger.d(); == Debug
  • FSLogger.e(); == Error
  • FSLogger.v(); == Verbose
  • FSLogger.i(); == Info
  • FSLogger.wtf(); == Assert

##Check Caller of our current function: If you want to see which class and in which line called your current message you have to add following code into your Application class:

//Result Before: //[ClassB.test()-120]: your log message  FSLogger.enableLoggingWithBackTrace();
  //Result After: //[MainActivity.onClick()-336]: [ClassB.test()-120]: your log message

Crashlytics

If you are using Crashlytics(Fabric.io), you can implement a log collector in Application class for your crashlytics like following:

FSLogger.disable();
 FSLogger.setListener(new FSLoggerListener() {

  @Override
  public void logout(FSLoggerLogType fsLoggerLogType, String tag, String message) {

logCrashlytics(fsLoggerLogType, tag, message);
  
}

 @Override
  public void logoutUnsuccess(FSLoggerLogType fsLoggerLogType, String tag, String message) {

logCrashlytics(fsLoggerLogType, tag, message);
  
}

 private void logCrashlytics(FSLoggerLogType fsLoggerLogType, String tag, String message) {

int log;

switch (fsLoggerLogType) {

 case Debug:

  log = Log.DEBUG;

  break;

 case Error:

  log = Log.ERROR;

  break;

 case Info:

  log = Log.INFO;

  break;

 case Verbose:

  log = Log.VERBOSE;

  break;

 case Warn:

  log = Log.WARN;

  break;

 case WTF:

  log = Log.VERBOSE;

  break;

 default:

  log = Log.VERBOSE;

}

Crashlytics.log(log, tag, message);
  
}
 
}
);

License

Apache 2.0

Resources

Showcase application of SQLDelight and SQLBrite working together based on SQLBrite's sample.

It is a lightweight library which helps to create a custom view.

Nice and simple customizable implementation of Google style up/down arrow.

WindView is an Android Library to show Weather's Wind & pressure Status.

A small routing library for Android with easy back button management and code generation to write less code.

A PhotoView to scale image and finish activity.

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