Skip to content

Commit f90f0e3

Browse files
committed
Add badges, community health: templates, conduct, security, fancy README
1 parent f966985 commit f90f0e3

6 files changed

Lines changed: 142 additions & 52 deletions

File tree

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Bug report
2+
about: Create a bug report to help us improve
3+
labels: bug
4+
body:
5+
- type: input
6+
attributes:
7+
label: What happened?
8+
description: Describe the bug in detail.
9+
validations:
10+
required: true
11+
- type: input
12+
attributes:
13+
label: Steps to reproduce
14+
description: Include code, platform, and reproduction steps.
15+
placeholder: |
16+
1. Code sample
17+
2. Compile/run this way
18+
3. Observe...
19+
validations:
20+
required: true
21+
- type: input
22+
attributes:
23+
label: Expected behavior
24+
description: What should have happened?
25+
placeholder: Clear statement of correct behavior...
26+
validations:
27+
required: true
28+
- type: textarea
29+
attributes:
30+
label: System details
31+
description: OS, compiler, and library versions
32+
placeholder: Ubuntu 22.04, g++ v10, ...
33+
validations:
34+
required: false
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
name: Feature request
2+
about: Suggest an idea for cLog
3+
labels: enhancement
4+
body:
5+
- type: input
6+
attributes:
7+
label: What feature do you want?
8+
description: Be as specific as possible.
9+
validations:
10+
required: true
11+
- type: textarea
12+
attributes:
13+
label: Motivation
14+
description: Why is this needed? What problem does it solve?
15+
validations:
16+
required: false
17+
- type: textarea
18+
attributes:
19+
label: Possible solution
20+
description: Optional: sketch or describe how this could work.
21+
validations:
22+
required: false

.github/pull_request_template.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
---
2+
name: Pull request
3+
about: Submit code, doc, or test improvements
4+
body:
5+
- type: textarea
6+
attributes:
7+
label: Whats changed?
8+
description: Link relevant Issue(s). Describe major changes and fixes.
9+
validations:
10+
required: true
11+
- type: checkboxes
12+
attributes:
13+
label: Checklist
14+
options:
15+
- label: Code builds/tests pass
16+
- label: Code is clean and commented
17+
- label: I have added or updated tests
18+
- label: I agree to license by MIT
19+
validations:
20+
required: true

CODE_OF_CONDUCT.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
We as members, contributors, and leaders pledge to make participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
5+
6+
## Our Standards
7+
Examples of behavior that contributes to a positive environment:
8+
- Using welcoming and inclusive language
9+
- Being respectful of differing viewpoints & experiences
10+
- Gracefully accepting constructive criticism
11+
- Focusing on what is best for the community
12+
- Showing empathy toward others
13+
14+
Examples of unacceptable behavior include:
15+
- The use of sexualized language or imagery & unwelcome advances
16+
- Trolling, insulting or derogatory comments & personal or political attacks
17+
- Public or private harassment
18+
19+
## Enforcement Responsibilities
20+
Project maintainers are responsible for clarifying standards and will take corrective action where needed.
21+
22+
## Enforcement
23+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an Issue or emailing the maintainer listed in the README. All complaints will be reviewed and investigated and results communicated back.
24+
25+
## Attribution
26+
This Code of Conduct is adapted from the Contributor Covenant, version 2.1: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html

README.md

Lines changed: 33 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,56 @@
1-
# cLog – Modern C++ Logging Library
1+
# cLog
22

3-
> **Frictionless, async-by-default, structured JSON logging for modern C++**
3+
[![Build Status](https://github.com/mbn-code/cLog/actions/workflows/ci.yml/badge.svg)](https://github.com/mbn-code/cLog/actions)
4+
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](LICENSE)
5+
[![GitHub stars](https://img.shields.io/github/stars/mbn-code/cLog?style=social)](https://github.com/mbn-code/cLog/stargazers)
46

5-
## Quickstart Example
6-
```cpp
7-
#include "logger.hpp"
8-
int main() {
9-
Logger log;
10-
log.info("system.start").kv("version", "1.0");
11-
}
12-
```
13-
**First log call launches a background worker thread for async output by default.**
7+
**Modern C++ Structured Logging Library**
148

159
---
1610

17-
## Features (Design Table)
18-
| Feature | Approach |
19-
|-------------------------|-----------------------------------------------------------------|
20-
| Installation | Single header, instant use, nlohmann/json is fully internal |
21-
| First Log | Async by default—first use launches worker thread, documented up front |
22-
| Sync Mode | Compile-time build flag for full sync, runtime opt-in if available |
23-
| No Macros | Never used—tooling, refactoring, and debugging always work |
24-
| Structured Logs | JSON output, no user-level JSON code |
25-
| Compile-time level | Minimal overhead when disabled; eliminates dead code |
26-
| Sinks | Console/file by default; custom/extensible sinks, not required |
27-
| Debug/Stack Context | Opt-in: header, adds stacktrace/thread/context as desired |
28-
| Thread Info | Included via debug header/opt-in only |
29-
| Config | (Future) JSON/YAML—deserializes to core logger API, never magic |
30-
| Testing/CI | GoogleTest + GitHub Actions, boring, predictable, cross-platform |
31-
| Docs/Examples | Always shows one-liner start, then advanced opt-ins |
11+
> **Async by default, chainable API, no macros.**
12+
> Extensible sinks, structured JSON out; robust thread lifecycle & lossless shutdown.
3213
3314
---
3415

35-
## Rationale and Values
36-
- **Zero-magic API**
37-
- **No macros ever**: Easy refactoring and debugging
38-
- **Async by default, never silent**: Docs and behavior preempt confusion
39-
- **Structured JSON output only**: No user-facing JSON APIs
40-
- **Extensible, but extensions never required**
16+
## ⭐️ Getting Started
4117

42-
For more, see [docs/PHILOSOPHY.md](docs/PHILOSOPHY.md) (to be added).
18+
```cpp
19+
#include "include/logger.hpp"
20+
#include "include/file_sink.hpp"
4321

44-
---
22+
int main() {
23+
c_log::Logger log;
24+
log.add_sink(std::make_unique<c_log::FileSink>("log.json"));
25+
log.info("startup").kv("user", "alice").kv("run", 1);
26+
}
27+
```
4528

46-
## Async and Sync Behavior
47-
- Async (background thread and queue) is the default. First log output launches async worker.
48-
- Sync mode: Compile-time flag disables async for embedded/hard-realtime, or use `Logger log(Logger::Mode::Sync);` at runtime where threads are available.
29+
#### Install
30+
Just add `include/` to your project. No dependencies outside C++17 STL and bundled nlohmann/json.
4931

5032
---
5133

52-
## Sinks and Extensibility
53-
- Output goes to stderr (JSON per line) by default
54-
- Register file or custom sinks using `.add_sink(std::make_unique<FileSink>("file.log"));`
55-
- All extensibility is opt-in. No required advanced config.
34+
## Features
35+
- Async and sync modes (`Logger::Mode`)
36+
- Automatic background flushing/shutdown
37+
- Console and file sink out-of-the-box
38+
- Fully structured logs (JSON)
39+
- Clean chainable API: `info().kv().kv()`
40+
- Robust: lossless, race-free, cross-platform tested
5641

5742
---
5843

59-
## Debugging, Stack, and Thread Context
60-
- Include `logger_debug.hpp` to add `.with_stacktrace()`/`.with_context()`/`.with_threadinfo()` to entries.
61-
- Zero core overhead unless debug features are requested.
44+
## Issues and Contributing
45+
- Please [open an Issue](https://github.com/mbn-code/cLog/issues) for bugs, features, or questions!
46+
- Star the repo if you find it useful ⭐
47+
- [Contributing Guide](CONTRIBUTING.md)
6248

6349
---
6450

65-
## FAQ
66-
- **Q: Do I ever need to touch JSON types?**
67-
> Never. JSON is entirely internal.
68-
69-
- **Q: Why async by default?**
70-
> For performance. You control opt-out via build or API.
51+
## License
52+
MIT - see [LICENSE](LICENSE)
7153

7254
---
7355

74-
## License
75-
MIT. Includes vendored [nlohmann/json](https://github.com/nlohmann/json) (MIT).
56+
*Project status: Alpha. API will stabilize with community use.*

SECURITY.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Security Policy
2+
3+
## Reporting a Vulnerability
4+
If you discover a security vulnerability in cLog, please open an Issue marked 'security' or email the maintainer listed in the README. Do **not** disclose it publicly until we have coordinated a fix.
5+
6+
## Supported Versions
7+
Only the latest release is supported.

0 commit comments

Comments
 (0)