Giter Site home page Giter Site logo

elvishew / xlog Goto Github PK

View Code? Open in Web Editor NEW
3.0K 60.0 408.0 1.62 MB

Android logger, pretty, powerful and flexible, log to everywhere, save to file, all you want is here.

License: Apache License 2.0

Java 99.71% Shell 0.29%
android log logger logcat file backup clean filter xml json

xlog's People

Contributors

elvishew avatar williamwue avatar wkingluoye avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

xlog's Issues

some confusion about filePrinter

The xLog is very powerful and pretty, i am excited in using it.
but when i use the function of printing log to the sdcrad, i meet some question.
for example,when i use a globalFilePrinter and a LocalFilePrinter in the same time,and set the file path same,and the filename generator by date as also, it would't create two log file, they will write in a same file. is it a BUG?
in another case, I just use a globalFilePrinter,then it will create one log file, does the xLog has the ability to clear the log file automatically ? If not ,the log file will be very large.

Pretty TimeStamp

Is there any way to change default timestamp from epoch to date string
1486381070403|D|X-LOG|Simple message
to
Mon, 06 Feb 2017 11:37:50.403 GMT|D|X-LOG|Simple message

log backup

Hi,I know Xlog is great,but I incomprehension why there is a log backup function,If you can tell me It applies to which scenes?I will be very grateful.

动态的设置TAG

在不同的类里面设置不用的TAG,不想使用局部的用法,每次设置很多参数太麻烦,怎样实现动态设置TAG

Parse JSON error

I init your xLog in the application onCreate() with XLog.init(LogLevel.ALL);, but when I run my project it fail to print json string, only give me this error com.elvishew.xlog.formatter.FormatException: Parse JSON error. It's works well using android.util.Log to print the json string, don't know anything wrong, any help?

出错没有抛出异常吗?

我在application的onCreate()中初始化的XLog,不知道什么原因执行到这里有时候回卡死在这里,捕获异常也没有反应,我猜测是内部异常了但是没有抛出,导致卡死

Check if XLog already initialized

Hi,

Can you add the possibility to check whether the XLog has already been initialized?

When I run a bunch of Robolectric tests the following exception is being thrown:

java.lang.RuntimeException: java.lang.IllegalStateException: XLog is already initialized, do not initialize again

I am initializing the XLog in my application subclass:

 override fun onCreate() {
        super.onCreate()

        XLog.init(if (BuildConfig.DEBUG) LogLevel.ALL else LogLevel.NONE)
 }

It seems that Robolectric creates the application multiple times but XLog for some reason stays initialized.

What do you think? Maybe the public getter of sIsInitialized would be enough to solve this issue?

how can I change log level after initiation?

I initialize XLog in my project by code:

XLog.init(new LogConfiguration.Builder()
                .logLevel(Config.isLogEnabled() ? LogLevel.ALL : LogLevel.NONE)
                .t()
                .st(3)
                .b()
                .build());

The log level is set to LogLevel.NONE in release version, but I have a secret log switch to debug something, so, how can I change log level after XLog initialized?

About stack trace info

Sometime I defined my L.java, and I use XLog in L.java.
L.java have some methods, example:

public static void e(String contents) {
    log(contents);
}

private static void log(String contents) {
    XLog.e(contents);
}

then I use L.java in MainActivity

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        L.e("Hello World");
}

I set st(3), and the log is :

├ com.whyalwaysmea.basemodule.L.log(L.java:156)
║ ├ com.whyalwaysmea.basemodule.L.e(L.java:127)
║ └ com.whyalwaysmea.diycode.MainActivity.onCreate(MainActivity.java:23)

Can I only see the last Info(MainActivity.java)? how to do it?
Thanks.

Bug? When logging to file, the time is not formatted but just a timestamp value

1479185204301|W|MY_TAG|╔═══════════════════════════════════════════════════════════════════════════════════════════════════
║Thread: RxComputationScheduler-1
╟───────────────────────────────────────────────────────────────────────────────────────────────────
║	├ com.jp.rxjavademo.MainActivity$9.onNext(MainActivity.java:236)
║	├ com.jp.rxjavademo.MainActivity$9.onNext(MainActivity.java:223)
║	├ rx.internal.util.ObserverSubscriber.onNext(ObserverSubscriber.java:34)
║	└ rx.observers.SafeSubscriber.onNext(SafeSubscriber.java:134)
╟───────────────────────────────────────────────────────────────────────────────────────────────────
║combineLatest: 177
╚═══════════════════════════════════════════════════════════════════════════════════════════════════

如何获取 sIsInitialized 变量?

up主,你好,我在初始化XLog的时候,设置了一个filePrinter,文件路径是通过一个封装过的工具类:StorageUtil获取的,获取这个路径的时候,做了一个“是否要创建目录”的判断,同时输出相关日志,此时由于XLog并未初始化,导致崩溃,所以,想手工判断一下是否初始化,否则不用XLog输出。

PS: XLog暂时用做日志文件备份,项目中还是有一个日志工具的,只不过在那个日志工具调用Log.x()后,再调用XLog

How to log to internal storage?

Hi,
I need help with writing log files to device internal storage. How do we do that with xlog? Any help will be appreciated. Thanks in advance.

无法打印json

String jsonString = "{"name": "Elvis", "age": 18}";
XLog.json(jsonString);

打印不出来..

日志格式有点别扭

老哥, 你好,
logcat打印的日志第一行的边框和和下面的没有对齐. 能否更改一下.
image

delete logs

can auto delete logs by time or other ways

在AS 3.0 上点击日志无法跳转

在AS 3.0 输出的日志不能点击跳转

代码配置:

XLog.init(new LogConfiguration.Builder()
                 .logLevel(BuildConfig.DEBUG ? LogLevel.ALL : LogLevel.NONE)
                .st(2)
                .b()
                .build());

日志如下:
image

Log is no longer show in my logcat , my device is HUAWEI BTV-W09

I just used XLOG in my project, it does not work on my pad , i have no idea about that , even logcat print no except about XLOG, but when i use Log.i(TAG,MSG) then i can get the MSG in my logcat, how can i fix that?
P.S. the HUAWEI BTV-W09 's sdk version is 25 (Android7.0)

Customizable log levels

I'm looking for a way to customize log levels. E.g. we don't use verbose but we do use critical (higher than error). Currently all I can do is "transpose" the log levels with a wrapper and an interceptor or something making everything a mess (and stack traces incorrect because the wrapper is irrelevant).

Custome tag

Hi.
First of all I have to say this is a very perfect library, But I wish it support custom tag likes log.

How to print the thread info and the code line number

你好,请问怎样打印出线程与输出日志所在的代码行数,就像orhanobut的logger中那样。
如下面的:
Thread: main与MainActivity.initData (MainActivity.java:66)
╔═══════════════════════════════════════════
║ Thread: main
╟──────────────────────────────
║ MainActivity.initData (MainActivity.java:66)
╟──────────────────────────────
║ {
║ "name": "Elvis",
║ "age": 18
║ }
╚═══════════════════════════════════════════

how to encrypt logs

Hi,
First of all thanks for such a wonderful library.
How can i encrypt/decrypt logs using this library. I want to store and read logs from encrypted file, so that normal user can't read the logs. One way is to add them in (.Folder) but still a user can access the files

Cannot print anything

Gradle:2.2.2
Debug build

I compiled this library in my project's library module.
And init it in my application by XLog.init(BuildConfig.DEBUG ? LogLevel.ALL : LogLevel.NONE, new LogConfiguration.Builder().t().b().build());.
The library module is compiled by compile project(':library') in gradle file.My application is registered correctly in AndroidManifest.xml.
But it cannot print anything in activity when invoke XLog.d(msg);.
What's wrong?Thx.

日志错位问题

Android studio 升级到3.1.4出现日志错位问题,2.3.3没有问题。
image
image

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.