{"id":34691629,"url":"https://github.com/cloudresty/emit","last_synced_at":"2026-05-26T06:01:33.938Z","repository":{"id":65298972,"uuid":"589188465","full_name":"cloudresty/emit","owner":"cloudresty","description":"Structured logging library for Go applications with built-in security features and industry-leading performance","archived":false,"fork":false,"pushed_at":"2025-07-04T11:53:12.000Z","size":184,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-01-14T23:38:37.584Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://cloudresty.com","language":"Go","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/cloudresty.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"docs/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-01-15T11:23:16.000Z","updated_at":"2025-08-11T22:01:02.000Z","dependencies_parsed_at":"2025-06-11T10:00:32.371Z","dependency_job_id":null,"html_url":"https://github.com/cloudresty/emit","commit_stats":null,"previous_names":["cloudresty/golog","cloudresty/emit","cloudresty/go-log"],"tags_count":14,"template":false,"template_full_name":null,"purl":"pkg:github/cloudresty/emit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudresty%2Femit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudresty%2Femit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudresty%2Femit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudresty%2Femit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudresty","download_url":"https://codeload.github.com/cloudresty/emit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudresty%2Femit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33506510,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T03:12:49.672Z","status":"ssl_error","status_checked_at":"2026-05-26T03:12:47.976Z","response_time":63,"last_error":"SSL_read: 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":[],"created_at":"2025-12-24T21:59:59.953Z","updated_at":"2026-05-26T06:01:33.931Z","avatar_url":"https://github.com/cloudresty.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Emit\n\nA lightweight, structured logging library for Go applications with **built-in security features** and **industry-leading** performance. Emit provides automatic PII/sensitive data masking while outperforming all major logging libraries.\n\n\u0026nbsp;\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/cloudresty/emit.svg)](https://pkg.go.dev/github.com/cloudresty/emit)\n[![Go Tests](https://github.com/cloudresty/emit/actions/workflows/test.yaml/badge.svg)](https://github.com/cloudresty/emit/actions/workflows/test.yaml)\n[![Go Report Card](https://goreportcard.com/badge/github.com/cloudresty/emit)](https://goreportcard.com/report/github.com/cloudresty/emit)\n[![GitHub Tag](https://img.shields.io/github/v/tag/cloudresty/emit?label=Version)](https://github.com/cloudresty/emit/tags)\n[![License](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n\n\u0026nbsp;\n\n- **Automatic data protection** - PII and sensitive data masked by default\n- **Elegant API** - `emit.Info.Msg()` for simplicity, `emit.Info.Field()` for structure\n\n\u0026nbsp;\n\n## Why Choose Emit?\n\n### Clean, Simple API\n\n```go\n// Payment logging with built-in PCI DSS compliance\nemit.Info.Field(\"Payment processed\",\n    emit.NewFields().\n        String(\"transaction_id\", \"txn_abc123\").\n        String(\"card_number\", \"4111-1111-1111-1111\").   // Auto-masked\n        String(\"cardholder\", \"John Doe\").               // Auto-masked\n        Float64(\"amount\", 99.99).\n        String(\"currency\", \"USD\").\n        Bool(\"success\", true))\n```\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n```go\n// Crystal clear intent - no cryptic function names\nemit.Info.Field(\"User authenticated\",\n    emit.NewFields().\n        String(\"user_id\", \"12345\").\n        String(\"email\", \"user@example.com\"). // Auto-masked: \"***PII***\"\n        Bool(\"success\", true))\n\n// Simple key-value pairs\nemit.Error.KeyValue(\"Payment failed\",\n    \"transaction_id\", \"txn_123\",\n    \"amount\", 99.99,\n    \"card_number\", \"4111-1111-1111-1111\")    // Auto-masked: \"***PII***\"\n```\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n### Zero-Config Security\n\nAutomatic protection of sensitive data without any configuration:\n\n```go\nemit.Info.Field(\"User registration\",\n    emit.NewFields().\n        String(\"email\", \"user@example.com\").      // → \"***PII***\"\n        String(\"password\", \"secret123\").          // → \"***MASKED***\"\n        String(\"api_key\", \"sk-1234567890\").       // → \"***MASKED***\"\n        String(\"username\", \"john_doe\").           // → \"john_doe\" (safe)\n        Int(\"user_id\", 12345))                    // → 12345 (safe)\n```\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n## Installation\n\n```bash\ngo get github.com/cloudresty/emit\n```\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n## Quick Start\n\n```go\npackage main\n\nimport (\n    \"time\"\n    \"github.com/cloudresty/emit\"\n)\n\nfunc main() {\n\n    // Clean, self-documenting API ✨\n\n    // Structured logging with clear intent\n    emit.Info.Field(\"User registration\",\n        emit.NewFields().\n            String(\"email\", \"user@example.com\").     // Auto-masked\n            String(\"username\", \"john_doe\").\n            Int(\"user_id\", 67890).\n            Bool(\"newsletter\", true).\n            Time(\"created_at\", time.Now()))\n\n    // Simple key-value pairs\n    emit.Error.KeyValue(\"Payment failed\",\n        \"transaction_id\", \"txn_123\",\n        \"amount\", 29.99,\n        \"currency\", \"USD\")\n\n    // Ultra-fast structured field logging\n    emit.Warn.StructuredFields(\"High memory usage\",\n        emit.ZString(\"service\", \"database\"),\n        emit.ZFloat64(\"memory_percent\", 87.5))\n\n    // Memory-pooled high-performance logging\n    emit.Debug.Pool(\"Database operation\", func(pf *emit.PooledFields) {\n        pf.String(\"query\", \"SELECT * FROM users\").\n           Int(\"rows\", 1234).\n           Float64(\"duration_ms\", 15.7)\n    })\n\n    // Simple messages\n    emit.Info.Msg(\"Application started successfully\")\n}\n```\n\n\u0026nbsp;\n\n**JSON Output (Production):**\n\n```json\n{\"timestamp\":\"2025-06-11T10:30:45.123456789Z\",\"level\":\"info\",\"message\":\"User registration\",\"fields\":{\"email\":\"***PII***\",\"username\":\"john_doe\",\"user_id\":67890,\"newsletter\":true,\"created_at\":\"2025-06-11T10:30:45.123456789Z\"}}\n{\"timestamp\":\"2025-06-11T10:30:45.124567890Z\",\"level\":\"error\",\"message\":\"Payment failed\",\"fields\":{\"transaction_id\":\"txn_123\",\"amount\":29.99,\"currency\":\"USD\"}}\n```\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n## Elegant API Overview\n\nEvery logging level (`Info`, `Error`, `Warn`, `Debug`) provides the same clean, consistent interface:\n\n```go\n// All levels support the same methods\nemit.Info.Msg(msg)                           // Simple message\nemit.Info.Field(msg, fields)                 // Structured fields\nemit.Info.StructuredFields(msg, zfields...)  // Ultra-fast structured fields (Zap-compatible)\nemit.Info.KeyValue(msg, k, v, ...)           // Key-value pairs\nemit.Info.Pool(msg, func)                    // Memory-pooled performance\n\n// Same elegant API for all levels\nemit.Error.Field(msg, fields)                // Error with structured data\nemit.Warn.KeyValue(msg, k, v, ...)           // Warning with key-values\nemit.Debug.StructuredFields(msg, zfields...) // Debug with structured fields\n```\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n## Key Features\n\n### Built-in Security\n\n- **Automatic PII masking** - Emails, phone numbers, addresses protected by default\n- **Sensitive data protection** - Passwords, API keys, tokens automatically masked\n- **GDPR/CCPA compliant** - Built-in compliance with privacy regulations\n- **Zero data leaks** - Impossible to accidentally log sensitive information\n\n\u0026nbsp;\n\n### Performance Optimized\n\n- **63.0 ns/op simple logging** - 23% faster than Zap\n- **96.0 ns/op structured fields** - 33% faster than Zap with zero allocations\n- **Zero-allocation API** - `StructuredFields()` methods achieve 0 B/op, 0 allocs/op\n- **Memory pooling** - `Pool()` methods for high-throughput scenarios\n\n\u0026nbsp;\n\n### Developer Friendly\n\n- **Elegant API** - Clear, self-documenting method names\n- **IDE-friendly** - Perfect autocomplete with `emit.Info.` discovery\n- **Zero dependencies** - Uses only Go standard library\n- **Environment-aware** - JSON for production, plain text for development\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n## Documentation\n\n\u0026nbsp;\n\n### Complete Guides\n\n- **[API Reference](docs/API_REFERENCE.md)** - Complete examples for all logging methods\n- **[Security Guide](docs/SECURITY.md)** - Security features and compliance examples\n- **[Performance Guide](docs/PERFORMANCE.md)** - Benchmarks and optimization strategies\n- **[Migration Guide](docs/MIGRATION.md)** - Migrate from other logging libraries\n- **[Benchmark Results](benchmarks/benchmark-results.md)** - Detailed performance comparisons\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n### Environment Configuration\n\n```bash\n# Production (secure by default)\nexport EMIT_FORMAT=json\nexport EMIT_LEVEL=info\n# PII and sensitive masking enabled automatically\n\n# Development (show data for debugging)\nexport EMIT_FORMAT=plain\nexport EMIT_LEVEL=debug\nexport EMIT_MASK_SENSITIVE=false\nexport EMIT_MASK_PII=false\n```\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n### Programmatic Setup\n\n```go\n// Quick setup\nemit.SetComponent(\"user-service\")\nemit.SetVersion(\"v2.1.0\")\nemit.SetLevel(\"info\")\n\n// Production mode (secure, JSON, info level)\nemit.SetProductionMode()\n\n// Development mode (show data, plain text, debug level)\nemit.SetDevelopmentMode()\n```\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n## Real-World Examples\n\n### Microservice Logging\n\n```go\n// Service initialization\nemit.SetComponent(\"auth-service\")\nemit.SetVersion(\"v1.2.3\")\n\n// Request logging with automatic security\nemit.Info.Field(\"API request\",\n    emit.NewFields().\n        String(\"method\", \"POST\").\n        String(\"endpoint\", \"/api/login\").\n        String(\"user_email\", userEmail).        // Auto-masked\n        String(\"client_ip\", clientIP).          // Auto-masked\n        Int(\"status_code\", 200).\n        Duration(\"response_time\", duration))\n```\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n### Payment Processing\n\n```go\n// Payment logging with built-in PCI DSS compliance\nemit.Info.Field(\"Payment processed\",\n    emit.NewFields().\n        String(\"transaction_id\", \"txn_abc123\").\n        String(\"card_number\", \"4111-1111-1111-1111\").  // Auto-masked\n        String(\"cardholder\", \"John Doe\").              // Auto-masked\n        Float64(\"amount\", 99.99).\n        String(\"currency\", \"USD\").\n        Bool(\"success\", true))\n```\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n### High-Performance Logging\n\n```go\n// Ultra-fast logging for hot paths\nfunc processRequest() {\n    start := time.Now()\n\n    // ... request processing\n\n    emit.Debug.StructuredFields(\"Request processed\",\n        emit.ZString(\"endpoint\", \"/api/data\"),\n        emit.ZInt(\"status\", 200),\n        emit.ZDuration(\"duration\", time.Since(start)))\n}\n```\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n## Migration from Other Loggers\n\n### From Standard Log\n\n```go\n// Before (UNSAFE)\nlog.Printf(\"User %s with password %s logged in\", username, password)\n\n// After (SECURE)\nemit.Info.KeyValue(\"User logged in\",\n    \"username\", username,      // Auto-protected if PII\n    \"password\", password)      // Auto-masked\n```\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n### From Logrus\n\n```go\n// Before (manual security)\nlogrus.WithFields(logrus.Fields{\n    \"email\": maskEmail(email),  // Manual masking required!\n}).Info(\"User action\")\n\n// After (automatic security)\nemit.Info.Field(\"User action\",\n    emit.NewFields().\n        String(\"email\", email))  // Auto-masked\n```\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n### From Zap\n\n```go\n// Before (complex, manual security)\nlogger.Info(\"Payment\",\n    zap.String(\"email\", maskPII(email)),     // Manual masking!\n    zap.String(\"card\", maskSensitive(card))) // Manual masking!\n\n// After (simple, automatic security)\nemit.Info.KeyValue(\"Payment processed\",\n    \"email\", email,    // Auto-masked\n    \"card\", card)      // Auto-masked\n```\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n## Compliance \u0026 Security\n\n### Automatic Compliance\n\n- **✅ GDPR** - EU personal data automatically protected\n- **✅ CCPA** - California privacy law compliance\n- **✅ HIPAA** - Healthcare data protection (with custom fields)\n- **✅ PCI DSS** - Payment card data automatically masked\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n### Protected Data Types\n\n**PII (Automatically Masked as `***PII***`)**\n\n- Email addresses, phone numbers, names\n- Addresses, IP addresses, credit cards\n- SSN, passport numbers, driver licenses\n\n**Sensitive Data (Automatically Masked as `***MASKED***`)**\n\n- Passwords, PINs, API keys\n- Access tokens, private keys, certificates\n- Session IDs, authorization headers\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n## Why Emit is the Secure Choice\n\n### Traditional Loggers\n\n- ❌ Manual data protection required\n- ❌ Easy to accidentally log sensitive data\n- ❌ Complex setup for production security\n- ❌ Risk of compliance violations\n\n\u0026nbsp;\n\n### Emit in a Nutshell\n\n- ✅ Automatic data protection out of the box\n- ✅ Impossible to accidentally expose PII/sensitive data\n- ✅ Zero-config security for production\n- ✅ Built-in compliance with privacy regulations\n- ✅ Elegant, developer-friendly API\n- ✅ Performance optimized for production workloads\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n## Real-World Impact Summary\n\n### Security: The Hidden Cost of Traditional Loggers\n\nWhen choosing a logging library, most developers focus solely on performance metrics. However, **security vulnerabilities in logging are among the most common causes of data breaches in production applications**:\n\n- **Data Breach Risk**: Traditional loggers like Zap and Logrus require developers to manually mask sensitive data. A single oversight can expose passwords, API keys, or PII in log files.\n- **Compliance Violations**: GDPR fines can reach €20M or 4% of annual revenue. CCPA violations cost up to $7,500 per record. Emit's automatic masking prevents these costly violations.\n- **Developer Burden**: Manual masking increases development time and introduces bugs. Emit eliminates this overhead entirely.\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n### Performance: Security Without Compromise\n\n**Traditional Assumption**: \"Security features must sacrifice performance\"\n**Emit Reality**: Built-in security with industry-leading speed\n\nOur benchmarks demonstrate that Emit's automatic security features add **zero performance overhead** compared to manual implementations: [Benchmark results](benchmarks/benchmark-results.md).\n\n**Key Insight**: Emit with automatic security (213 ns/op) is significantly faster than Logrus without any security protection (2,872 ns/op), and competitive with Zap's unsafe mode (171 ns/op) while providing complete data protection.\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n### Production Impact: Beyond Benchmarks\n\n#### Traditional Logging Workflow\n\n1. Write logging code\n2. Manually identify sensitive fields\n3. Implement custom masking functions\n4. Review code for security issues\n5. Test masking implementations\n6. Monitor for data leaks in production\n7. **Risk**: One missed field = potential breach\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n#### Emit Workflow\n\n1. Write logging code\n2. **Done** - Security is automatic and guaranteed\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n#### Cost Analysis\n\n**Medium-sized application (10 developers, 2-year development cycle)**:\n\n```plaintext\nTraditional Loggers:\n- Security implementation time: 40 hours/developer = 400 hours\n- Security review overhead: 20% of logging code reviews = 80 hours\n- Bug fixes for missed masking: 20 hours\n- Total: 500 hours × $150/hour = $75,000\n\nEmit:\n- Security implementation time: 0 hours (automatic)\n- Security review overhead: 0 hours (automatic)\n- Bug fixes: 0 hours (impossible to leak data)\n- Total: $0\n\nROI: $75,000 saved + zero breach risk\n```\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n### When to Choose Each Approach\n\n**Choose Emit when**:\n\n- Building production applications with sensitive data\n- Compliance requirements (GDPR, CCPA, HIPAA, PCI DSS)\n- Team includes junior developers\n- Performance is critical\n- Development speed matters\n\n**Choose traditional loggers when**:\n\n- Working with completely non-sensitive data\n- You have dedicated security experts on your team\n- You enjoy implementing custom security solutions\n- Vendor lock-in concerns outweigh security benefits\n\n**Bottom Line**: Emit delivers the security of enterprise logging solutions with the performance of the fastest libraries and the simplicity of modern APIs.\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n## Get Started\n\n1. **Install**: `go get github.com/cloudresty/emit`\n2. **Basic usage**: `emit.Info.Msg(\"Hello, secure world!\")`\n3. **Add structure**: `emit.Info.KeyValue(\"User action\", \"user_id\", 123)`\n4. **Go advanced**: `emit.Info.Field(\"Complex event\", emit.NewFields()...)`\n5. **Optimize performance**: `emit.Info.StructuredFields(\"Hot path\", emit.ZString(...))`\n\n**Choose emit for secure, compliant, and elegant logging in your Go applications.**\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n## Performance Breakthrough: Zero-Allocation Structured Fields\n\nEmit achieves what was previously thought impossible in Go logging - **zero heap allocations** for structured field logging while maintaining full compatibility with Zap-style APIs.\n\n```go\n// Zero-allocation structured logging (Zap-compatible API)\nemit.Info.StructuredFields(\"User action\",          // 96 ns/op, 0 B/op, 0 allocs/op\n    emit.ZString(\"user_id\", \"12345\"),\n    emit.ZString(\"action\", \"login\"),\n    emit.ZString(\"email\", \"user@example.com\"),      // → \"***MASKED***\" (automatic)\n    emit.ZBool(\"success\", true))\n\n// Compare with Zap (requires heap allocations)\nzapLogger.Info(\"User action\",                      // 143 ns/op, 259 B/op, 1 allocs/op\n    zap.String(\"user_id\", \"12345\"),\n    zap.String(\"action\", \"login\"),\n    zap.String(\"email\", \"user@example.com\"),        // → \"user@example.com\" (exposed!)\n    zap.Bool(\"success\", true))\n```\n\n\u0026nbsp;\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n**Performance Comparison:**\n\n- **33% faster** than Zap's structured logging\n- **Zero memory allocations** vs Zap's heap allocations\n- **Built-in security** vs manual implementation required\n\n🔝 [back to top](#emit)\n\n\u0026nbsp;\n\n\u0026nbsp;\n\n---\n\n### Cloudresty\n\n[Website](https://cloudresty.com) \u0026nbsp;|\u0026nbsp; [LinkedIn](https://www.linkedin.com/company/cloudresty) \u0026nbsp;|\u0026nbsp; [BlueSky](https://bsky.app/profile/cloudresty.com) \u0026nbsp;|\u0026nbsp; [GitHub](https://github.com/cloudresty) \u0026nbsp;|\u0026nbsp; [Docker Hub](https://hub.docker.com/u/cloudresty)\n\n\u003csub\u003e\u0026copy; Cloudresty - All rights reserved\u003c/sub\u003e\n\n\u0026nbsp;\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudresty%2Femit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudresty%2Femit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudresty%2Femit/lists"}