https://github.com/djoezeke/celog
A Fast , Convenient and Lightweight Header Only C/C++ Logging Library.
https://github.com/djoezeke/celog
asynchronous c cpp cross-platform header-only high-performance logger logging logging-library low-latency
Last synced: over 1 year ago
JSON representation
A Fast , Convenient and Lightweight Header Only C/C++ Logging Library.
- Host: GitHub
- URL: https://github.com/djoezeke/celog
- Owner: djoezeke
- License: mit
- Created: 2025-03-06T00:25:04.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-03-08T01:52:02.000Z (over 1 year ago)
- Last Synced: 2025-03-08T02:24:43.957Z (over 1 year ago)
- Topics: asynchronous, c, cpp, cross-platform, header-only, high-performance, logger, logging, logging-library, low-latency
- Language: C
- Homepage:
- Size: 6.84 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Celog đ
Celog is a lightweight logging library for C/C++ projects.
It provides various logging levels and supports colored and styled output for better readability.
## Features â¨
- Multiple log levels:
- EMERGENCY đ¨
- ALERT â ī¸
- CRITICAL â
- ERROR â
- WARNING â ī¸
- NOTICE đĸ
- INFO âšī¸
- DEBUG đ
- Colored and styled output đ¨
- File and function information in log messages đ
- Configurable log level, color, and style settings âī¸
## Installation đ ī¸
To use Celog in your project, simply include the `celog.h` header file in your source files.
```cpp
#include "celog.h"
```
## Usage đ
### Log Levels
Celog provides the following log levels:
- `celog_emerg`: Emergency messages đ¨
- `celog_alert`: Alert messages â ī¸
- `celog_crit`: Critical messages â
- `celog_error`: Error messages â
- `celog_warn`: Warning messages â ī¸
- `celog_notice`: Notice messages đĸ
- `celog_info`: Informational messages âšī¸
- `celog_debug`: Debug messages đ
### Example
```cpp
#include "celog.h"
int main() {
celog_emerg("This is an emergency message");
celog_alert("This is an alert message");
celog_crit("This is a critical message");
celog_error("This is an error message");
celog_warn("This is a warning message");
celog_notice("This is a notice message");
celog_info("This is an informational message");
celog_debug("This is a debug message");
return 0;
}
```
## Configuration âī¸
You can configure the log level, color, and style settings by defining or uncommenting the following macros in `ceconfig.h`:
- `CELOG_LOG_LEVEL`: Set the log level (default: 7)
- `CELOG_COLOR`: Enable or disable colored output (default: 1)
- `CELOG_STYLE`: Enable or disable styled output (default: 1)
### Example Configuration
To customize the logging behavior, you can modify the `ceconfig.h` file:
```cpp
// Set the log level to WARNING
#define CELOG_LOG_LEVEL 4
// Disable file information in log messages
#define CELOG_NO_FILE_INFO
// Disable function information in log messages
#define CELOG_NO_FUNC_INFO
```
### Log Level Controls
Celog allows you to control the log levels by defining the `CELOG_LOG_LEVEL` macro.
Messages with a log level lower than the defined level will be disabled.
### Log Information Controls
Celog allows you to control the log information by defining:
- `CELOG_NO_FILE_INFO`: Disables logging of file information (file name and line number).
- `CELOG_NO_FUNC_INFO`: Disables logging of function information (function name).
### Color and Style Controls
You can disable colors and styles by setting `CELOG_COLOR` and `CELOG_STYLE` to 0, respectively.
## License đ
This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
## Contributing đ¤
Contributions are welcome! Please open an issue or submit a pull request on GitHub.
## Acknowledgements đ
Celog is inspired by various logging libraries and aims to provide a simple and lightweight solution for C/C++ projects.