{"id":23983428,"url":"https://github.com/cploutarchou/loggix","last_synced_at":"2026-02-17T15:34:27.735Z","repository":{"id":271305883,"uuid":"899716448","full_name":"cploutarchou/loggix","owner":"cploutarchou","description":"🦀 Loggix: A powerful, thread-safe structured logging library for Rust. Features colored terminal output, JSON formatting, and field support. Inspired by Logrus, it combines beautiful output with production-ready performance.","archived":false,"fork":false,"pushed_at":"2025-04-10T18:01:35.000Z","size":36604,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-22T18:49:54.291Z","etag":null,"topics":["debugging","development-tools","json-logging","logger","logging","logrus","rust","rust-library","structured-logging","terminal-output","thread-safe"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cploutarchou.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-12-06T21:22:35.000Z","updated_at":"2025-04-10T18:01:39.000Z","dependencies_parsed_at":"2025-01-06T22:54:00.816Z","dependency_job_id":"ebefac1e-bc53-4227-b59a-ae5cdeaaae3e","html_url":"https://github.com/cploutarchou/loggix","commit_stats":null,"previous_names":["cploutarchou/loggix"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cploutarchou/loggix","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cploutarchou%2Floggix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cploutarchou%2Floggix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cploutarchou%2Floggix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cploutarchou%2Floggix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cploutarchou","download_url":"https://codeload.github.com/cploutarchou/loggix/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cploutarchou%2Floggix/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29548363,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-17T14:33:00.708Z","status":"ssl_error","status_checked_at":"2026-02-17T14:32:58.657Z","response_time":100,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["debugging","development-tools","json-logging","logger","logging","logrus","rust","rust-library","structured-logging","terminal-output","thread-safe"],"created_at":"2025-01-07T12:17:13.732Z","updated_at":"2026-02-17T15:34:22.727Z","avatar_url":"https://github.com/cploutarchou.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Loggix\n\nA high-performance, async-first logging framework for Rust with Kafka integration.\n\n## Features\n\n- Flexible logging levels (TRACE, DEBUG, INFO, WARN, ERROR, FATAL, PANIC)\n- Structured logging with key-value pairs\n- Customizable formatters (text and JSON included)\n- Asynchronous logging support\n  - `log_async` method for async contexts\n  - Non-blocking operations\n  - Tokio runtime integration\n- Hook system for log processing and forwarding\n  - Sync and async hook support\n  - Multiple hooks per logger\n  - Level-based filtering\n- Kafka integration with support for:\n  - Asynchronous message delivery\n  - Custom message keys via fields\n  - Topic configuration\n  - Error handling and retries\n  - Automatic topic creation\n  - Message key routing\n- Thread-safe logging\n- Zero-allocation logging paths\n- Configurable output destinations\n- Colorized console output (optional)\n- Comprehensive benchmarks\n- Full test coverage\n\n## Installation\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nloggix = \"1.0\"\n```\n\n## Quick Start\n\n### Basic Logging\n\n```rust\nuse loggix::{Logger, Level, Fields};\n\n// Create a logger\nlet logger = Logger::new().build();\n\n// Log a message\nlet mut fields = Fields::new();\nfields.insert(\"user_id\".to_string(), \"123\".into());\nlogger.log(Level::Info, \"User logged in\", fields).unwrap();\n\n// Async logging\nlet mut fields = Fields::new();\nfields.insert(\"order_id\".to_string(), \"456\".into());\nlogger.log_async(Level::Info, \"Order processed\", fields).await.unwrap();\n```\n\n### Structured Logging with JSON\n\n```rust\nuse loggix::{Logger, JSONFormatter, Level, Fields};\nuse serde_json::Value;\n\nlet logger = Logger::new()\n    .formatter(JSONFormatter::new())\n    .build();\n\nlet mut fields = Fields::new();\nfields.insert(\"transaction_id\".to_string(), Value::String(\"tx-123\".to_string()));\nfields.insert(\"amount\".to_string(), Value::Number(100.into()));\nlogger.log(Level::Info, \"Payment processed\", fields).unwrap();\n```\n\n## Kafka Integration\n\n### Setting up Kafka\n\n1. Start the Kafka environment:\n```bash\ndocker-compose up -d\n```\n\n2. Create a logger with Kafka hook:\n```rust\nuse loggix::{Logger, KafkaHook, Level, Fields};\nuse serde_json::Value;\n\n// Create a Kafka hook with message key support\nlet kafka_hook = KafkaHook::new(\"localhost:9092\", \"logs\")\n    .unwrap()\n    .with_key_field(\"correlation_id\".to_string());\n\n// Create a logger with the Kafka hook\nlet logger = Logger::new()\n    .add_hook(kafka_hook)\n    .build();\n\n// Log a message with a correlation ID for message routing\nlet mut fields = Fields::new();\nfields.insert(\"correlation_id\".to_string(), Value::String(\"abc-123\".to_string()));\nfields.insert(\"user_id\".to_string(), Value::String(\"456\".to_string()));\nlogger.log_async(Level::Info, \"User action\", fields).await.unwrap();\n```\n\n### Message Key Support\n\nThe Kafka hook supports setting a field as the message key:\n\n```rust\n// Set up hook with a key field\nlet kafka_hook = KafkaHook::new(\"localhost:9092\", \"logs\")\n    .unwrap()\n    .with_key_field(\"tenant_id\".to_string());\n\n// Any log message with the tenant_id field will use it as the Kafka message key\nlet mut fields = Fields::new();\nfields.insert(\"tenant_id\".to_string(), Value::String(\"tenant-1\".to_string()));\nlogger.log_async(Level::Info, \"Tenant action\", fields).await.unwrap();\n```\n\nThis enables:\n- Message routing based on keys\n- Message partitioning\n- Message deduplication\n- Message ordering within partitions\n\n### Async Support\n\nBoth the logger and hooks support async operations:\n\n```rust\n// Async logging with hooks\nlogger.log_async(Level::Info, \"Async message\", fields).await?;\n\n// Hooks automatically use async operations when available\nimpl Hook for MyHook {\n    fn fire_async\u003c'a\u003e(\u0026'a self, entry: \u0026'a Entry) -\u003e Pin\u003cBox\u003cdyn Future\u003cOutput = Result\u003c(), Error\u003e\u003e + Send + 'a\u003e\u003e {\n        // Async implementation\n    }\n}\n```\n\n## Examples\n\nSee the `examples/` directory for more examples:\n- Basic logging\n- Custom formatters\n- Kafka integration\n- Async logging\n- Structured logging\n- Error handling\n\n## Benchmarks\n\nRun the benchmarks:\n```bash\ncargo bench\n```\n\nExample benchmark results:\n- Sync logging: ~1800ns/iter\n- Async logging: ~2000ns/iter\n- Kafka logging: ~10000ns/iter (network latency not included)\n\n## Configuration\n\n### YAML Configuration\n\nCreate a `config.yaml` file:\n```yaml\nkafka:\n  bootstrap_servers: \"localhost:9092\"\n  group_id: \"logger_group\"\n  auto_offset_reset: \"earliest\"\n  socket_timeout_ms: 3000\n  session_timeout_ms: 6000\n  replication_factor: 1\n  partitions: 1\n```\n\n## Performance Tips\n\n1. Use `log_async` in async contexts\n2. Reuse field collections when possible\n3. Consider message key strategy for Kafka partitioning\n4. Use appropriate log levels to minimize processing\n5. Configure appropriate batch sizes for Kafka\n\n## Roadmap\n\n- [ ] ElasticSearch integration\n- [ ] Log rotation\n- [ ] Log compression\n- [ ] Sampling and filtering\n- [ ] OpenTelemetry integration\n- [ ] Prometheus metrics\n- [ ] Log aggregation\n- [ ] Log analytics\n\n## Changelog\n\nFor a detailed list of changes between versions, please see our [CHANGELOG](CHANGELOG.md).\n\n## License\n\nThis project is licensed under the MIT License - see the LICENSE file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcploutarchou%2Floggix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcploutarchou%2Floggix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcploutarchou%2Floggix/lists"}