Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/gordonzhang2024/log.cc
A light-weight and easy-to-use logging library for C++
https://github.com/gordonzhang2024/log.cc
cplusplus cplusplus-library cpp cpp17 library logger logger-middleware logging logging-library logs
Last synced: 3 months ago
JSON representation
A light-weight and easy-to-use logging library for C++
- Host: GitHub
- URL: https://github.com/gordonzhang2024/log.cc
- Owner: GordonZhang2024
- License: mit
- Created: 2024-05-10T10:42:42.000Z (9 months ago)
- Default Branch: main
- Last Pushed: 2024-08-12T06:20:53.000Z (6 months ago)
- Last Synced: 2024-08-12T07:39:50.305Z (6 months ago)
- Topics: cplusplus, cplusplus-library, cpp, cpp17, library, logger, logger-middleware, logging, logging-library, logs
- Language: C++
- Homepage:
- Size: 3.22 MB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Log.cc
A simple logging library for C++
![GitHub License](https://img.shields.io/github/license/GordonZhang2024/log.cc)
![Static Badge](https://img.shields.io/badge/love-love?label=%E2%9D%A4%EF%B8%8FMade%20with&labelColor=black&color=red)## Usage
> Log.cc is very easy to use.
>
> To use log.cc for your own project, you only need to copy `src/log.cc` and `src/log.h` to your own source directory.### Example
```cpp
#include "log.h"int main()
{
logger l("log.txt");
l.log(ERROR, "error message");
return 0;
}```
> [!NOTE]
>
> #### Available levels
>
> - TRACE
> - DEBUG
> - INFO
> - WARNING
> - ERROR
> - FATAL**The full example is in the `example/` directory. You can find more useful functions from `log.cc`**
*The following examples use `l` as the default logger name.*
### Want to format the output?
You can use the `log()` function in this way, just like `printf()`:
```cpp
l.log(WARNING, "%d", 1);
```
> [!IMPORTANT]
> Don't forget to set the log level (which is the first argument of the `log()` function).> [!TIP]
> ### More info
> **There are also many useful functions in *log.cc***.
> **You can view the [Wiki page](https://github.com/GordonZhang2024/log.cc/wiki/Log.cc-usage) for more info.**## License
[MIT License](https://github.com/GordonZhang2024/log.cc/blob/main/LICENSE)