Log Filter


Source link: https://github.com/smart-fun/LogFilter

Log Filter

Log Filter is a helper to set the Log Level of your App, for example setting VERBOSE in Debug mode and ERROR in Release mode. This way you see all the logs when debugging, but only the errors in release.

Usage

You need to initialize and keep a reference to the logger in your Application class

public class MainApplication extends Application {

private Log mLog;

@Override
  public void onCreate() {

super.onCreate();

 if (BuildConfig.DEBUG) {

 mLog = new Log(Log.Priority.VERBOSE);

}
 else {

 mLog = new Log(Log.Priority.ERROR);

}

}
 
}

Just as a reminder, to add an Application class to your app, you need to update the manifest with a android:name attribut in the application tag:

<?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="com.mycompany.myapp">

<application

android:name=".MainApplication"

...

Then the usage is exactly the same as for the android Log class. You just need to replace the android.util.Log import with fr.arnaudguyon.logfilter.Log:

//import android.util.Log import fr.arnaudguyon.logfilter.Log  public class MainActivity extends AppCompatActivity {

private static final String TAG = "MainActivity";

@Override
  protected void onCreate(Bundle savedInstanceState) {

super.onCreate(savedInstanceState);

 setContentView(R.layout.activity_main);

 Log.v(TAG, "VERBOSE TEST");

Log.d(TAG, "DEBUG TEST");

Log.i(TAG, "INFO TEST");

Log.w(TAG, "WARNING TEST");

Log.e(TAG, "ERROR TEST");

}
 
}
 

That's it.

Installation with gradle

Add the following maven{ } line to your PROJECT build.gradle file

allprojects {

  repositories {

jcenter()

maven {
 url "https://jitpack.io" 
}

 // add this line
  
}
 
}
 

Add the libary dependency to your APP build.gradle file

dependencies {

  compile 'com.github.smart-fun:LogFilter:1.0.1'
 // add this line 
}
 

##License##

Copyright 2016 Arnaud Guyon

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Resources

A small customizable library useful to handle an gallery image pick action built-in your app.

Handling Android Permission Rationale Properly.

Android Instagram Connector: use Instagram API.

This application helps you to connect to instagram API i two simple steps.

Android library that adds methods isForeground / isBackground / isReturnedFromBackground.

The Sweetest way into saving and loading to SharedPreferences.

Android RxJava library for Social auth (Google, Facebook) and Smart Lock For Passwords.

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