logly 0.0.4

High-performance, structured logging library with async support, rotation, filtering, and GPU/CPU optimization
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
# Contributing to logly-rs

Thank you for your interest in contributing to logly-rs! We welcome contributions of all kinds.

## Table of Contents
- [Code of Conduct]#code-of-conduct
- [Getting Started]#getting-started
- [Development Setup]#development-setup
- [How to Contribute]#how-to-contribute
- [Code Style]#code-style
- [Testing]#testing
- [Documentation]#documentation
- [Pull Request Process]#pull-request-process
- [Reporting Bugs]#reporting-bugs
- [Feature Requests]#feature-requests

## Code of Conduct

By participating in this project, you agree to abide by our [Code of Conduct](CODE_OF_CONDUCT.md).

## Getting Started

### Prerequisites

- Rust 1.70.0 or later
- Cargo (latest stable)
- Git
- (Optional) CUDA Toolkit for GPU features

### Fork and Clone

1. Fork the repository on GitHub
2. Clone your fork:

```bash
git clone https://github.com/your-username/logly-rs.git
cd logly-rs
```

3. Add upstream remote:

```bash
git remote add upstream https://github.com/muhammad-fiaz/logly-rs.git
```

## Development Setup

### Build the Project

```bash
cargo build
```

### Run Tests

```bash
cargo test
```

### Run Examples

```bash
cargo run --example basic
cargo run --example advanced
```

### Build Documentation

```bash
cargo doc --open
```

### Run Benchmarks

```bash
cargo bench
```

## How to Contribute

### 1. Create a Branch

```bash
git checkout -b feature/my-feature
# or
git checkout -b fix/my-bugfix
```

### 2. Make Changes

- Write clear, concise code
- Follow Rust best practices
- Add tests for new features
- Update documentation
- Ensure all tests pass

### 3. Commit Changes

```bash
git add .
git commit -m "feat: add new feature"
# or
git commit -m "fix: resolve issue #123"
```

Commit message format:
- `feat:` New feature
- `fix:` Bug fix
- `docs:` Documentation changes
- `test:` Test additions/changes
- `refactor:` Code refactoring
- `perf:` Performance improvements
- `chore:` Maintenance tasks

### 4. Push Changes

```bash
git push origin feature/my-feature
```

### 5. Create Pull Request

- Go to GitHub and create a pull request
- Fill in the PR template
- Link related issues
- Wait for review

## Code Style

### Rust Style Guidelines

- Follow [Rust API Guidelines]https://rust-lang.github.io/api-guidelines/
- Use `rustfmt` for formatting:

```bash
cargo fmt
```

- Use `clippy` for linting:

```bash
cargo clippy -- -D warnings
```

### Code Quality

- Write idiomatic Rust code
- Avoid unsafe code unless absolutely necessary
- Document unsafe blocks with safety comments
- Use meaningful variable and function names
- Keep functions small and focused
- Minimize dependencies

### Documentation

- Add doc comments for public APIs:

```rust
/// Logs a message at the specified level.
///
/// # Arguments
///
/// * `level` - The log level
/// * `message` - The message to log
///
/// # Examples
///
/// ```
/// logger.log(Level::Info, "Hello".to_string())?;
/// ```
pub fn log(&self, level: Level, message: String) -> Result<()> {
    // ...
}
```

## Testing

### Writing Tests

- Add unit tests in the same file:

```rust
#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn test_feature() {
        // Test code
    }
}
```

- Add integration tests in `tests/`:

```rust
use logly::prelude::*;

#[test]
fn test_integration() {
    // Integration test
}
```

### Test Coverage

- Aim for high test coverage
- Test edge cases
- Test error conditions
- Test concurrent scenarios

### Running Specific Tests

```bash
# Run specific test
cargo test test_name

# Run tests with output
cargo test -- --nocapture

# Run tests in specific file
cargo test --test integration_tests
```

## Documentation

### Types of Documentation

1. **API Documentation**: Doc comments in code
2. **Guides**: Markdown files in `docs/guides/`
3. **Examples**: Working examples in `examples/`
4. **README**: Main project documentation

### Updating Documentation

- Update relevant docs when changing features
- Add examples for new features
- Keep README.md up to date
- Update CHANGELOG.md

## Pull Request Process

### Before Submitting

1. **Run all checks**:

```bash
cargo fmt --check
cargo clippy -- -D warnings
cargo test
cargo build --all-features
```

2. **Update documentation**
3. **Add tests**
4. **Update CHANGELOG.md**

### PR Requirements

- Clear description of changes
- Link to related issues
- All tests passing
- No compiler warnings
- Documentation updated
- Code formatted with rustfmt
- Clippy checks passing

### Review Process

1. Maintainer reviews PR
2. Address feedback
3. Update PR as needed
4. Approval and merge

## Reporting Bugs

### Before Reporting

- Check existing issues
- Verify it's reproducible
- Test with latest version

### Bug Report Template

```markdown
**Description**
Clear description of the bug

**To Reproduce**
1. Step 1
2. Step 2
3. See error

**Expected Behavior**
What should happen

**Actual Behavior**
What actually happens

**Environment**
- OS: [e.g., Windows 11]
- Rust version: [e.g., 1.70.0]
- logly version: [e.g., 0.0.4]

**Additional Context**
Any other relevant information
```

## Feature Requests

### Proposing Features

1. Check existing feature requests
2. Open an issue with `[Feature Request]` prefix
3. Describe the feature clearly
4. Explain use cases
5. Discuss implementation approach

### Feature Request Template

```markdown
**Feature Description**
Clear description of the feature

**Use Case**
Why is this feature needed?

**Proposed Solution**
How should it work?

**Alternatives**
Other approaches considered

**Additional Context**
Any other relevant information
```

## Areas for Contribution

### High Priority

- Bug fixes
- Performance improvements
- Documentation improvements
- Test coverage

### Feature Ideas

- Network sinks (TCP/UDP)
- Syslog integration
- Windows Event Log support
- Log compression
- Log encryption
- Metrics and statistics
- Rate limiting

### Documentation Needs

- More examples
- Tutorial videos
- Blog posts
- Translations

## Development Tips

### Debugging

```rust
// Enable debug mode
logger.enable_debug();

// Use debug_log_file
config.debug_log_file = Some(PathBuf::from("debug.log"));
```

### Performance Testing

```bash
cargo bench
```

### Memory Profiling

```bash
cargo build --release
valgrind --tool=massif target/release/your_binary
```

## Getting Help

- **Documentation**: https://muhammad-fiaz.github.io/logly-rs
- **Issues**: https://github.com/muhammad-fiaz/logly-rs/issues
- **Discussions**: https://github.com/muhammad-fiaz/logly-rs/discussions

## License

By contributing, you agree that your contributions will be licensed under the MIT License.

## Recognition

Contributors will be:
- Listed in CONTRIBUTORS.md
- Mentioned in release notes
- Credited in documentation

Thank you for contributing to logly-rs! 🎉