Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About some opened issues and niche needs (关于一些未关闭的问题、一些小众需求) #255

Open
elvishew opened this issue Jun 24, 2021 · 1 comment

Comments

@elvishew
Copy link

Years ago, I found logger in GitHub and was shocked by the pretty format, shortly after that, I implemented this feature in my own project logger framework xLog.
多年前,我在 github 上发现了 logger 并被它漂亮的格式所震惊,在那不久以后,我就在我的日志框架 xLog 里也实现了这个特性。

Today, I happened to found logger has got 10k+ stars, I am interested in it and start to download the code and learn from it. It's awesome, that such a lightweight tool has already helped so many developers.
今天,我偶然发现 logger 已经超过 1 万的 star,这让我对其代码产生了浓厚兴趣,于是开始下载并阅读,看能否从中学习到什么。一个如此轻量的工具竟然已经帮忙了多么多开发者,真的很厉害。

After I read the code and analyze the opened issues, I realized:
在我阅读了代码并分析了那些未关闭的问题后,我发现:

  1. for most cases, logger is good enough.
    大多数情况下,logger 都足以满足你的需求。

  2. for some opened issues, some niche needs, maybe xLog can meet your needs while logger can not.
    对于一些未关闭的问题、一些小众的需求,在 logger 不能很好满足你的具体需求时,也许 xLog 可以满足你。

Here is the details:
详情如下:

#254 #211
Log folder's write permission related issues
保存日志的文件权限相关问题
you can change a folder that doesn't need permission to save log file.
你可以换一个不需要权限的目录来保存日志文件。
logger: can not change log folder.
logger: 无法改变日志目录
xLog: can specify the folder when creating a FilePrinter.
xLog: 当创建 FilePrinter 时可指定目录。

#248 #221
How to customize tag
自定义 tag 相关问题
logger: not well supported. Use Logger.t(yourTag).*(msg), and the final tag would be globalTag-yourTag, and you may need it to be yourTag.
logger: 支持不是很好。可以使用 Logger.t(yourTag).*(msg),但最终的 tag 会变成 globalTag-yourTag,而你可能希望它是 yourTag
xLog: totally supported. Use XLog.tag(tag).*(msg) for specific scenarios, or create a Logger with specific tag for specific scenarios.
xLog: 完全支持。在特定场景里使用 XLog.tag(tag).*(msg),或为特定场景创建一个特定 tag 的 Logger

#243
Save android.util.Log.*(msg) logs to file
保存 android.util.Log.*(msg) 打印的日志到文件
logger: not supported.
logger: 不支持
xLog: supported. Use LibCat in xLog.
xLog: 支持。用 xLog 中的 LibCat

#219
Customize log file name
自定义日志文件名字
logger: not supported. It is hardcoded as logs in DiskLogStrategy.
logger: 不支持。在 DiskLogStrategy 中写死了文件名为 logs
xLog: supported. Use a FileNameGenerator to specify your log file name or the rule of the log file name.
xLog: 支持。可使用 FileNameGenerator 来指定日志文件名,或指定日志文件名的规则。

#213
Keep stack trace info when save log to file using CsvFormatStrategy
希望在写日志到文件时,能保留像打印在 logcat 一样的调用栈信息
logger: pass a DiskLogStrategy to PrettyFormatStrategy, you can log pretty format to file, but without time info.
logger: 传入一个 DiskLogStrategyPrettyFormatStrategy,可以将与 logcat 一样格式的日志保存到文件中,但缺少时间信息。
xLog: the message printed in logcat and file is totally the same, but you still can make a difference to them.
xLog: 在 logcat 里和文件里的日志格式是完全一样的。但你仍然可以让它们不一样。

#212
Only keep thread info and stack trace info when logging error log
仅对 error 日志打印线程信息和调用栈信息
logger: not supported.
logger: 不支持。
xLog: supported. Use an Interceptor to remove thread info and stack trace info when the level is less than ERROR
xLog: 支持。可使用 Interceptor 来移除 error 日志中的线程信息和调用栈信息。

older issues: Not analyzed...
更早的问题:未分析

All of the above contents, if any mistake, feel free to correct me
以上所有内容,如有错误,望不吝指正。

@RahulSDeshpande
Copy link

@elvishew I totally agree with @elvishew ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants