#255·logger

关于一些尚未解决的问题和一些小众需求

作者: elvishew创建于 2021年6月24日更新于 2024年1月12日

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. 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. After I read the code and analyze the opened issues, I realized:

  1. for most cases, logger is good enough.
  2. for some opened issues, some niche needs, maybe xLog can meet your needs while logger can not. 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. xLog: can specify the folder when creating a FilePrinter. #248 #221 How to customize 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. xLog: totally supported. Use XLog.tag(tag).*(msg) for specific scenarios, or create a Logger with specific tag for specific scenarios. #243 Save android.util.Log.*(msg) logs to file logger: not supported. xLog: supported. Use LibCat in xLog. #219 Customize log file name logger: not supported. It is hardcoded as logs in DiskLogStrategy. xLog: supported. Use a FileNameGenerator to specify your log file name or the rule of the log file name. #213 Keep stack trace info when save log to file using CsvFormatStrategy logger: pass a DiskLogStrategy to PrettyFormatStrategy, you can log pretty format to file, but without time info. xLog: the message printed in logcat and file is totally the same, but you still can make a difference to them. #212 Only keep …

内容来源: orhanobut/logger