Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/archibate/minilog
Mini Logging Library with C++20 education purpose
https://github.com/archibate/minilog
Last synced: 11 days ago
JSON representation
Mini Logging Library with C++20 education purpose
- Host: GitHub
- URL: https://github.com/archibate/minilog
- Owner: archibate
- Created: 2023-08-22T05:42:09.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-08-22T06:12:55.000Z (about 1 year ago)
- Last Synced: 2023-08-22T07:25:55.506Z (about 1 year ago)
- Language: C++
- Size: 365 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# minilog
Mini Logging Library for C++20
> This is a single-header-only log library, simply copy the `minilog.h` to your project (C++20 required) and include it would work.
```cpp
#include "minilog.h"int main() {
minilog::log_info("hello, the answer is {}", 42);
minilog::log_critical("this is right-aligned [{:>+10.04f}]", 3.14);minilog::log_warn("good job, {1:.5s} for making {0}", "minilog", "archibate");
minilog::set_log_level(minilog::log_level::trace); // default log level is infoint my_variable = 42;
MINILOG_P(my_variable); // shown when log level lower than debug
}
```![minilogcolorshow](minilogcolorshow.png)
> Formatting are based on C++20 [`std::format`](https://en.cppreference.com/w/cpp/utility/format/format).
```bash
cmake -B build
cmake --build build
export MINILOG_LEVEL=trace # set default log level from environment variable
build/main
```Demostration video: https://www.bilibili.com/video/BV1t94y1r72E
Available log levels are:
- trace
- debug
- info
- critical
- warn
- error
- fatal