GithubHelp home page GithubHelp logo

dcn01 / llog Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lorcanluo/llog

0.0 1.0 0.0 110 KB

在日常开发过程中,一些后台服务,比如IM,后台定时任务,都需要一套本地日志系统来监控程序是否正常,Android本身提供的日志系统只能在终端显示,为了模拟一套和android Log系统相同的环境,我自己写了一套本地日志系统来解决以上问题。

Java 100.00%

llog's Introduction

Android本地日志工具

在日常开发过程中,一些后台服务,比如IM,后台定时任务,都需要一套本地日志系统来监控程序是否正常,Android本身提供的日志系统只能在终端显示,为了模拟一套和android Log系统相同的环境,我自己写了一套本地日志系统来解决以上问题。

为了能让不同等级的日志以不同的颜色显示,我用html的方式来实现,这样我们通过浏览器打开就可以了。演示效果如下: htmldemoimg

github地址: https://github.com/lorcanluo/LLog

##使用方法

在你的Application或则主Activity调用:

LLog.init(this.getPackageName());

方法来初始化,传入参数为你需要存放文件的目录。

目前支持三种级别的日志:

普通消息

在文件中以黑色字体显示

调用方法:

   /**
     * info log
     *
     * @param tag Used to identify the source of a log message.  It usually identifies
     *            the class or activity where the log call occurs.
     * @param msg The message you would like logged.
     */
    public static void i(String tag, String msg) {

    }

调试信息

在文件中以绿色字体显示

调用方式:

/**
     * debug log
     *
     * @param tag Used to identify the source of a log message.  It usually identifies
     *            the class or activity where the log call occurs.
     * @param msg The message you would like logged.
     */
    public static void d(String tag, String msg) {

    }

错误信息

在文件中以红色字体显示

调用方法:

    /**
     * error log
     *
     * @param tag Used to identify the source of a log message.  It usually identifies
     *            the class or activity where the log call occurs.
     * @param msg The message you would like logged.
     */
    public static void e(String tag, String msg) {

    }

关闭日志

如果你不想在正式环境输出日志,可以调用以下方法来屏蔽日志输出:

/**
 * open or close the function
 *
 * @param isDebuggable if set to false, not print the message.
 */
 public static void setIsDebuggable(boolean isDebuggable)()

问题

有什么问题,可以直接提交issus 或则联系我 email [email protected]

llog's People

Contributors

lorcanluo avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.