android-CLog


Source link: https://github.com/liaohuqiu/android-CLog

?????

A Simple Log Tool

An encapsulation of android.util.Log, which provides:

  • Log level control You can display different log according different environment.

  • Log with parameters

    CLog.d("sample", "Here is a debug message with parameters: %d", 1);
     

Import to your project

You can copy the source code to your source code directory, it only a single file.

This library has been pushed to Maven Central, you can import it by pom or gradle.

Maven

<dependency>
  <groupId>in.srain.cube</groupId>
  <artifactId>clog</artifactId>
  <type>jar</type>
  <version>1.0.2</version> </dependency>

Gradle

compile 'in.srain.cube:clog:1.0.2'

Usage

Package

import in.srain.cube.util.CLog;

Log level

public static final int LEVEL_VERBOSE = 0; public static final int LEVEL_DEBUG = 1; public static final int LEVEL_INFO = 2; public static final int LEVEL_WARNING = 3; public static final int LEVEL_ERROR = 4; public static final int LEVEL_FATAL = 5; 

Default log level is LEVEL_VERBOSE. The log whose log is lower than log level you set by calling setLogLevel will not been printed.

For example, you set log level to LEVEL_INFO, the log sent by CLog.d or CLog.v will not been print.

Set log level according to the environment

if (environment.equals("production")) {

  // production
  CLog.setLogLevel(CLog.LEVEL_ERROR);
 
}
 else if (environment.equals("beta")) {

  // beta
  CLog.setLogLevel(CLog.LEVEL_WARNING);
 
}
 else {

  // development
  CLog.setLogLevel(CLog.LEVEL_VERBOSE);
 
}
 

Print log

CLog.d("sample", "Here is a debug message");
 CLog.d("sample", "Here is a debug message with parameters: %d", 1);
 

License

Apache 2

Contact & Help

Please fell free to contact me if there is any problem when using the library.

Resources

GSON analog for serialization/deserialization of Java objects into HTML code and back.

Change color of words (or substrings) into a TextView.

FingerLock is a library designed to make fingerprint authentication an easy task for Android developers.

AllowMe simple library to handle Android M permissions easily.

A material design music player for Android using google's ExoPlayer library, based off Pasta for Spotify.

Fluent design by contract assertions for Android.

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