Skip to content
/ flog Public

A friendly, flexible, feature-rich and fair logger for Android.

License

Notifications You must be signed in to change notification settings

RubiTree/flog

Repository files navigation

FLog

License

A friendly, flexible, feature-rich and fair logger for Android.

Feature

  1. 自定义Tag、调用栈、线程信息、时间信息、级别、内容、附加线、极简风格...
  2. 打印错误设定报告。
  3. 自定义所有设定的默认值。
  4. Custom Tag, call stack, thread information, time information, level, content, additional lines, minimalist style...
  5. Can print error report.
  6. Customize all default settings.

Usage

Add Two Dependencies

debugCompile 'com.github.SaltedfishCaptain:flog:1.0.1:debug@aar'
releaseCompile 'com.github.SaltedfishCaptain:flog:1.0.1:release@aar'

If you have not use library from JitPack before, you should add this in your project build.gradle.

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

Sample

FLog.print("Hello FLog");

FLog.tag("FLog").print("Hello FLog");

FLog.tag("FLog").count(4).showThread().showTime().print("Hello FLog");

FLog.tag("FLog").count(100).excludeThis(this).withJson(JSON_STRING).print("Hello FLog");

FLog.tag("FLog").singleLine().showFooterLine().showHeardLine().print("Hello FLog");

...

Setting

This is optional, if you want to use your custom default setting value, you can go on reading.
Suggest that call this method only once in Application class, begin with init() and end at anywhere.
This setting will just replace the default value at each print.
Your new setting at each print will cover this setting.

public class FLogApplication extends Application {
    @Override
    public void onCreate() {
        super.onCreate();
        configFLog();
    }

    private void configFLog() {
        FLog.init().count(6).dateFormat("MM_dd hh:mm:ss SSS").v();
    }
}

Tips

  1. 通过链式调用非常灵活得对打印内容进行配置:tag、调用栈、线程信息、时间信息、级别、内容、附加线、极简风格...
  2. 配置过程对链式调用顺序没有要求,只要在最后调用print方法,就表示配置结束,开始打印。
  3. FLog在主项目处于release状态时不会进行打印。
  4. 参考了 logger 让打印内容更加美观。
  5. The chain is very flexible to call the configuration of the print content: tag, call stack, thread information, time information, level, content, additional lines, minimalist style...
  6. The configuration process does not require a chain call sequence, as long as the print method is called at the end, the configuration is completed, and begin print.
  7. FLog will not print when the master project is in the release state.
  8. Reference to logger to make print content more pretty.
  9. And use this logger may make your project have a long life.

APIs

to be continue...

  1. init()...
  2. tag(String tag)
  3. offset(int offset)
  4. count(int count)
  5. exclude(Class<?>... excludeClasses)
  6. excludeThis(Object object)
  7. showThread()
  8. showTime()
  9. withJson(String json)
  10. withObject(String object)
  11. singleLine()
  12. showHeardLine()
  13. showFooterLine()
  14. todo()
  15. d()
  16. e()
  17. w()
  18. i()
  19. v()
  20. print(String message, Object... args)

License

Apache License 2.0, here is the LICENSE.

About

A friendly, flexible, feature-rich and fair logger for Android.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages