

GitHub - Meituan-Dianping/Logan: Logan is a lightweight case logging system base...
source link: https://github.com/Meituan-Dianping/Logan
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md
Logan
Logan is a lightweight case logging system based on mobile platform.
Getting started
Android
Installation
Add the following content in the project build.gradle
file:
compile 'com.dianping.android.sdk:logan:1.0.0'
Usage
You must init Logan before you use it. For example:
LoganConfig config = new LoganConfig.Builder() .setCachePath(getApplicationContext().getFilesDir().getAbsolutePath()) .setPath(getApplicationContext().getExternalFilesDir(null).getAbsolutePath() + File.separator + "logan_v1") .setEncryptKey16("0123456789012345".getBytes()) .setEncryptIV16("0123456789012345".getBytes()) .build(); Logan.init(config);
After you init Logan, you can use Logan to write a log. Like this:
Logan.w("test logan", 1);
Logan.w method has two parameters:
- String log: What you want to write;
- int type: Log type. This is very important, best practices below content will show you how to using log type parameter.
If you want to write log to file immediately, you need to call flush function:
Logan.f();
If you want to see all of the log file information, you need to call getAllFilesInfo function:
Map<String, Long> map = Logan.getAllFilesInfo();
- key: Log file date;
- value: Log file size(Bytes).
Upload
Logan internal provides logging upload mechanism, in view of the need to upload the log to do the preprocessing. If you want to upload log file, you need to implement a SendLogRunnable:
public class RealSendLogRunnable extends SendLogRunnable { @Override public void sendLog(File logFile) { // logFile: After the pretreatment is going to upload the log file } }
Finally you need to call Logan.s method:
Logan.s(date, mSendLogRunnable);
One of the first parameter is date array(yyyy-MM-dd).
iOS
Installation
Logan supports CocoaPods methods for installing the library in a project.
Podfile
Import Logan in Xcode project, add Logan in podfile.
source 'https://github.com/CocoaPods/Specs.git' platform :ios, '8.0' target 'TargetName' do pod 'Logan', '~> 1.0.0' end
Then run the following command:
$ pod install
Logan Init
You must init Logan before you use it:
#import "Logan.h" NSData *keydata = [@"0123456789012345" dataUsingEncoding:NSUTF8StringEncoding]; NSData *ivdata = [@"0123456789012345" dataUsingEncoding:NSUTF8StringEncoding]; uint64_t file_max = 10 * 1024 * 1024; // logan init,incoming 16-bit key,16-bit iv,largest written to the file size(byte) loganInit(keydata, ivdata, file_max); #if DEBUG loganUseASL(YES); #endif
Usage
Write a log:
logan(1, @"this is a test");
Best Practices
Before Logan available, log report system is relatively scattered.
To put it simply, the traditional idea is to piece together the problems that appear in the logs of each system, but the new idea is to aggregate and analyze all the logs generated by the user to find the scenes with problems.
The Logan core system consists of four modules:
- Input
- Storage
- BackEnd
- FrontEnd
The new case analysis process is as follows:
Article
A lightweight case logging system based on mobile platform developed by Meituan-Dianping — Logan.
Feature
In the future, we will provide a data platform based on Logan big data, including advanced functions such as machine learning, troubleshooting log solution, and big data feature analysis.
Finally, we hope to provide a more complete integrated case analysis ecosystem.
Module Open Source Processing Planning iOS √
Android √
Web
√
Mini Programs
√
Back End
√ Front End
√
Contributing
For more information about contributing PRs and issues, see our Contribution Guidelines.
License
MIT
Recommend
-
237
tinylogger An extremely lightweight logging framework for BASH scripts. Developed and tested on MacOS. This should work on any BASH platform. Log levels It supports four levels, default being INFO.
-
149
GitHub is where people build software. More than 28 million people use GitHub to discover, fork, and contribute to over 80 million projects.
-
79
README.md 关于 2019届大三学生,前段时间一直想一个人单独开发一个较为完整的项目,在众多应用中,考虑之后选择了美团外卖来模仿,这段时间就利用课余时间进行开发,前端用vue+vuex+vue-router+axios,因为...
-
52
README.md Beeshell 一个 React Native 应用的基础组件库,基于 0.53.3 版本,提供一整套开箱即用的高质量组件,包含 JS 组件和复合组件(包含 Native...
-
65
README.md WMRouter WMRouter是一款Android路由框架,基于组件化的设计思路,有功能灵活强大、使用简单的特点。 功能简介 WMRouter主要提供URI分...
-
17
README.md Willow
-
14
Get Percuma Emtee Logan Album Mp3 Download Fakaza MP3Emtee Logan Album Mp3 Download Fakaza Free Emtee Logan Album Mp3 Download Fakaza Mp3 download. This song has been watched 54,319 times. Download Emtee...
-
8
Grab Unique Emtee Logan Album Mp3 MP3Emtee Logan Album Mp3 Free Emtee Logan Album Mp3 Mp3 download. This song has been watched 54,167 times. Download Emtee - LOGAN (Full Album) Mp3. You can download emtee...
-
11
Scrape Free Emtee Logan Album Release MP3Emtee Logan Album Release Free Emtee Logan Album Release Mp3 download. This song has been watched 54,319 times. Download Emtee - LOGAN (Full Album) Mp3. You can do...
-
80
美团限时抢红包 天天神券 脚本 求star 求关注 拒绝白嫖 呜呜呜 之前所有旧版本都存在重大逻辑问题,新版本已修复,请不要使用旧版 一.每日自动签到领美团豆(可兑换红包必中符),每日可领七次 二.每日自动抢天天神券(道具...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK