Skip to content

Commit e3d04b7

Browse files
committed
docs: improve README and add community files
- Enhance README with centered logo, badges, and better structure - Add CONTRIBUTING.md with development guidelines - Add CODE_OF_CONDUCT.md based on Contributor Covenant - Add CHANGELOG.md following Keep a Changelog format
1 parent 3b86080 commit e3d04b7

4 files changed

Lines changed: 191 additions & 118 deletions

File tree

CHANGELOG.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.1.0] - 2026-01-13
9+
10+
### Added
11+
12+
- Initial release of LogTide Python SDK
13+
- Automatic batching with configurable size and interval
14+
- Retry logic with exponential backoff
15+
- Circuit breaker pattern for fault tolerance
16+
- Max buffer size with drop policy
17+
- Query API for searching and filtering logs
18+
- Live tail with Server-Sent Events (SSE)
19+
- Trace ID context for distributed tracing
20+
- Global metadata support
21+
- Structured error serialization
22+
- Internal metrics tracking
23+
- Logging methods: debug, info, warn, error, critical
24+
- Thread-safe operations
25+
- Graceful shutdown with atexit hook
26+
- Flask middleware for auto-logging HTTP requests
27+
- Django middleware for auto-logging HTTP requests
28+
- FastAPI middleware for auto-logging HTTP requests
29+
- Full type hints support for Python 3.8+
30+
31+
[0.1.0]: https://github.com/logtide-dev/logtide-sdk-python/releases/tag/v0.1.0

CODE_OF_CONDUCT.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Code of Conduct
2+
3+
## Our Pledge
4+
5+
We are committed to providing a welcoming and inclusive environment for everyone, regardless of background or identity.
6+
7+
## Our Standards
8+
9+
Examples of behavior that contributes to a positive environment:
10+
11+
- Being respectful and inclusive
12+
- Accepting constructive criticism gracefully
13+
- Focusing on what is best for the community
14+
- Showing empathy towards others
15+
16+
Examples of unacceptable behavior:
17+
18+
- Harassment, trolling, or insulting comments
19+
- Personal or political attacks
20+
- Publishing others' private information without permission
21+
- Other conduct that would be inappropriate in a professional setting
22+
23+
## Enforcement
24+
25+
Project maintainers have the right to remove, edit, or reject comments, commits, code, issues, and other contributions that are not aligned with this Code of Conduct.
26+
27+
## Reporting
28+
29+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at **support@logtide.dev**.
30+
31+
All complaints will be reviewed and investigated promptly and fairly.
32+
33+
## Attribution
34+
35+
This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.1.

CONTRIBUTING.md

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Contributing to LogTide Python SDK
2+
3+
Thank you for your interest in contributing!
4+
5+
## Development Setup
6+
7+
1. Clone the repository:
8+
```bash
9+
git clone https://github.com/logtide-dev/logtide-sdk-python.git
10+
cd logtide-sdk-python
11+
```
12+
13+
2. Create a virtual environment:
14+
```bash
15+
python -m venv venv
16+
source venv/bin/activate # On Windows: venv\Scripts\activate
17+
```
18+
19+
3. Install dev dependencies:
20+
```bash
21+
pip install -e ".[dev]"
22+
```
23+
24+
## Code Style
25+
26+
- Follow [PEP 8](https://peps.python.org/pep-0008/) style guide
27+
- Use type hints for all public APIs
28+
- Format code with [Black](https://black.readthedocs.io/)
29+
- Lint with [Ruff](https://docs.astral.sh/ruff/)
30+
- Use meaningful variable and function names
31+
- Add docstrings for public functions and classes
32+
33+
## Testing
34+
35+
```bash
36+
# Run tests
37+
pytest tests/
38+
39+
# Run with coverage
40+
pytest --cov=logtide_sdk tests/
41+
42+
# Type checking
43+
mypy logtide_sdk/
44+
45+
# Code formatting
46+
black logtide_sdk/ tests/ examples/
47+
48+
# Linting
49+
ruff check logtide_sdk/
50+
```
51+
52+
## Pull Request Process
53+
54+
1. Fork the repository
55+
2. Create a feature branch (`git checkout -b feature/amazing-feature`)
56+
3. Make your changes
57+
4. Ensure tests pass (`pytest tests/`)
58+
5. Format code (`black .`)
59+
6. Commit your changes (`git commit -m 'Add amazing feature'`)
60+
7. Push to the branch (`git push origin feature/amazing-feature`)
61+
8. Open a Pull Request
62+
63+
## Reporting Issues
64+
65+
- Use the GitHub issue tracker
66+
- Provide clear description and reproduction steps
67+
- Include Python version and OS information
68+
- Include relevant logs and error messages
69+
70+
## Questions?
71+
72+
Feel free to open an issue for any questions or discussions!

README.md

Lines changed: 53 additions & 118 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,36 @@
1-
# LogTide Python SDK
1+
<p align="center">
2+
<img src="https://raw.githubusercontent.com/logtide-dev/logtide/main/docs/images/logo.png" alt="LogTide Logo" width="400">
3+
</p>
24

3-
Official Python SDK for LogTide with advanced features: automatic batching, retry logic, circuit breaker, query API, live streaming, and middleware support.
5+
<h1 align="center">LogTide Python SDK</h1>
6+
7+
<p align="center">
8+
<a href="https://pypi.org/project/logtide-sdk/"><img src="https://img.shields.io/pypi/v/logtide-sdk?color=blue" alt="PyPI"></a>
9+
<a href="LICENSE"><img src="https://img.shields.io/badge/License-MIT-blue.svg" alt="License"></a>
10+
<a href="https://www.python.org/"><img src="https://img.shields.io/badge/Python-3.8+-blue.svg" alt="Python"></a>
11+
<a href="https://github.com/logtide-dev/logtide-sdk-python/releases"><img src="https://img.shields.io/github/v/release/logtide-dev/logtide-sdk-python" alt="Release"></a>
12+
</p>
13+
14+
<p align="center">
15+
Official Python SDK for <a href="https://logtide.dev">LogTide</a> with automatic batching, retry logic, circuit breaker, query API, live streaming, and middleware support.
16+
</p>
17+
18+
---
419

520
## Features
621

7-
- **Automatic batching** with configurable size and interval
8-
- **Retry logic** with exponential backoff
9-
- **Circuit breaker** pattern for fault tolerance
10-
- **Max buffer size** with drop policy to prevent memory leaks
11-
- **Query API** for searching and filtering logs
12-
- **Live tail** with Server-Sent Events (SSE)
13-
- **Trace ID context** for distributed tracing
14-
- **Global metadata** added to all logs
15-
- **Structured error serialization**
16-
- **Internal metrics** (logs sent, errors, latency, etc.)
17-
- **Flask, Django & FastAPI middleware** for auto-logging HTTP requests
18-
- **Full Python 3.8+ support** with type hints
22+
- **Automatic batching** with configurable size and interval
23+
- **Retry logic** with exponential backoff
24+
- **Circuit breaker** pattern for fault tolerance
25+
- **Max buffer size** with drop policy to prevent memory leaks
26+
- **Query API** for searching and filtering logs
27+
- **Live tail** with Server-Sent Events (SSE)
28+
- **Trace ID context** for distributed tracing
29+
- **Global metadata** added to all logs
30+
- **Structured error serialization**
31+
- **Internal metrics** (logs sent, errors, latency, etc.)
32+
- **Flask, Django & FastAPI middleware** for auto-logging HTTP requests
33+
- **Full Python 3.8+ support** with type hints
1934

2035
## Requirements
2136

@@ -28,7 +43,7 @@ Official Python SDK for LogTide with advanced features: automatic batching, retr
2843
pip install logtide-sdk
2944
```
3045

31-
### Optional dependencies
46+
### Optional Dependencies
3247

3348
```bash
3449
# For async support
@@ -103,33 +118,33 @@ client = LogTideClient(
103118
ClientOptions(
104119
api_url='http://localhost:8080',
105120
api_key='lp_your_api_key_here',
106-
121+
107122
# Batching
108123
batch_size=100,
109124
flush_interval=5000,
110-
125+
111126
# Buffer management
112127
max_buffer_size=10000,
113-
114-
# Retry with exponential backoff (1s 2s 4s)
128+
129+
# Retry with exponential backoff (1s -> 2s -> 4s)
115130
max_retries=3,
116131
retry_delay_ms=1000,
117-
132+
118133
# Circuit breaker
119134
circuit_breaker_threshold=5,
120135
circuit_breaker_reset_ms=30000,
121-
136+
122137
# Metrics & debugging
123138
enable_metrics=True,
124139
debug=True,
125-
140+
126141
# Global context
127142
global_metadata={
128143
'env': os.getenv('APP_ENV'),
129144
'version': '1.0.0',
130145
'hostname': os.uname().nodename,
131146
},
132-
147+
133148
# Auto trace IDs
134149
auto_trace_id=False,
135150
)
@@ -205,8 +220,6 @@ with client.with_trace_id('request-456'):
205220
### Auto-Generated Trace ID
206221

207222
```python
208-
import uuid
209-
210223
with client.with_new_trace_id():
211224
client.info('worker', 'Background job started')
212225
client.info('worker', 'Job completed')
@@ -321,7 +334,9 @@ client.reset_metrics()
321334

322335
---
323336

324-
## Middleware
337+
## Middleware Integration
338+
339+
LogTide provides ready-to-use middleware for popular frameworks.
325340

326341
### Flask Middleware
327342

@@ -411,48 +426,6 @@ See the [examples/](./examples) directory for complete working examples:
411426

412427
---
413428

414-
## API Reference
415-
416-
### LogTideClient
417-
418-
#### Constructor
419-
```python
420-
client = LogTideClient(options: ClientOptions)
421-
```
422-
423-
#### Logging Methods
424-
- `log(entry: LogEntry) -> None`
425-
- `debug(service: str, message: str, metadata: dict = None) -> None`
426-
- `info(service: str, message: str, metadata: dict = None) -> None`
427-
- `warn(service: str, message: str, metadata: dict = None) -> None`
428-
- `error(service: str, message: str, metadata_or_error: dict | Exception = None) -> None`
429-
- `critical(service: str, message: str, metadata_or_error: dict | Exception = None) -> None`
430-
431-
#### Context Methods
432-
- `set_trace_id(trace_id: str | None) -> None`
433-
- `get_trace_id() -> str | None`
434-
- `with_trace_id(trace_id: str)` → context manager
435-
- `with_new_trace_id()` → context manager
436-
437-
#### Query Methods
438-
- `query(options: QueryOptions) -> LogsResponse`
439-
- `get_by_trace_id(trace_id: str) -> list[dict]`
440-
- `get_aggregated_stats(options: AggregatedStatsOptions) -> AggregatedStatsResponse`
441-
442-
#### Streaming
443-
- `stream(on_log: callable, on_error: callable = None, filters: dict = None) -> None`
444-
445-
#### Metrics
446-
- `get_metrics() -> ClientMetrics`
447-
- `reset_metrics() -> None`
448-
- `get_circuit_breaker_state() -> CircuitState`
449-
450-
#### Lifecycle
451-
- `flush() -> None`
452-
- `close() -> None`
453-
454-
---
455-
456429
## Best Practices
457430

458431
### 1. Always Close on Shutdown
@@ -502,13 +475,13 @@ import threading
502475
def monitor_metrics():
503476
while True:
504477
metrics = client.get_metrics()
505-
478+
506479
if metrics.logs_dropped > 0:
507-
print(f"⚠️ Logs dropped: {metrics.logs_dropped}")
508-
480+
print(f"Warning: Logs dropped: {metrics.logs_dropped}")
481+
509482
if metrics.circuit_breaker_trips > 0:
510-
print("🔴 Circuit breaker is OPEN!")
511-
483+
print("Error: Circuit breaker is OPEN!")
484+
512485
time.sleep(60)
513486

514487
# Run in background thread
@@ -518,54 +491,16 @@ monitor_thread.start()
518491

519492
---
520493

521-
## Development
522-
523-
### Setup
524-
525-
```bash
526-
# Clone repository
527-
git clone https://github.com/logtide-dev/python-sdk.git
528-
cd logtide-sdk-python
529-
530-
# Create virtual environment
531-
python -m venv venv
532-
source venv/bin/activate # On Windows: venv\Scripts\activate
533-
534-
# Install dev dependencies
535-
pip install -e ".[dev]"
536-
```
537-
538-
### Testing
539-
540-
```bash
541-
# Run tests
542-
pytest tests/
543-
544-
# Type checking
545-
mypy logtide_sdk/
546-
547-
# Code formatting
548-
black logtide_sdk/ tests/ examples/
549-
550-
# Linting
551-
ruff check logtide_sdk/
552-
```
494+
## Contributing
553495

554-
---
496+
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
555497

556498
## License
557499

558-
MIT
559-
560-
---
561-
562-
## Contributing
563-
564-
Contributions are welcome! Please open an issue or PR on [GitHub](https://github.com/logtide-dev/python-sdk).
565-
566-
---
500+
MIT License - see [LICENSE](LICENSE) for details.
567501

568-
## Support
502+
## Links
569503

570-
- **Documentation**: [https://logtide.dev/docs](https://logtide.dev/docs)
571-
- **Issues**: [GitHub Issues](https://github.com/logtide-dev/python-sdk/issues)
504+
- [LogTide Website](https://logtide.dev)
505+
- [Documentation](https://logtide.dev/docs/sdks/python/)
506+
- [GitHub Issues](https://github.com/logtide-dev/logtide-sdk-python/issues)

0 commit comments

Comments
 (0)