EasyLogger is an ultra-lightweight (ROM<1.6K, RAM<0.3K), high-performance C/C++ log library, which is ideal for resource-sensitive software projects, such as: IoT products, wearable devices, smart homes, and more. Compared with well-known C/C++ log libraries such as log4c and zlog, EasyLogger has simpler functions and provides fewer interfaces to users, but it will be quick to get started. More practical functions support dynamic expansion in the form of plug-ins.
Explanation of nouns:
- 1. RAW format: unformatted original log.
- 2. Tags: In the software, you can set tags for logs that need to be printed according to files, modules, functions, etc. to realize log classification.
I will provide more plugins later. We are also very welcome to design and develop more practical plug-ins and functions to improve EasyLogger (Github|OSChina|Coding) . If you think this open source project is great, you can click Star in the upper right corner of the project homepage and recommend it to more friends in need.
EasyLogger has properties such as filtering method, output format, and output switch.
Note: Currently, parameter configuration and output methods are singleton mode, that is, only one configuration method is supported globally. In this mode, the software will be simpler, but it cannot support complex output methods.
Refer to Android Logcat, the highest level is 0 (Assert) and the lowest level is 5 (Verbose).
0.[A]:断言(Assert)
1.[E]:错误(Error)
2.[W]:警告(Warn)
3.[I]:信息(Info)
4.[D]:调试(Debug)
5.[V]:详细(Verbose)
The default color effect of logs at each level is as follows. Users can also set the colors and font styles of logs at elog_cfg.h according to their preferences.
Support filtering by level, label and keyword . When there is a lot of log content, the filtering function can be used to locate the log faster to ensure the readability of the log. For more filter function settings and details, please read the docszhapikernel.md document
Note: RAW format and hexdump format logs do not support tags and keyword filtering.
The output format supports: level, time, label, process information, thread information, file path, line number, method name. Each priority level can set the output format independently.
Through user porting, any output method can be supported. However, for new functions that may be introduced in a certain output method, it needs to be implemented through plug-ins, such as file transfer, retrieval of Flash logs, etc. More plug-ins will be open source later. The following is a brief comparison of some of the output usage scenarios:
The following figure shows the input commands in the terminal to control the log output and filter settings, which more intuitively demonstrates the core functions of EasyLogger.
demoosrt-threadstm32f10xdocszhapikernel.mddocszhportkernel.mdThe following process is to output logs through the console and store the output logs into Flash. Restart and read the last saved log, and finally clear the Flash log.
demoosrt-threadstm32f10xdocszhapiflash.mddocszhportflash.mdThe FIle plug-in allows you to automatically save logs to files. Each file can be sized. After exceeding the specified size, a new file will be automatically created to store the log.
For specific content, refer to the file under docszh . Be sure to use it after reading the document .
MIT Copyright (c) [email protected]