{"id":19674531,"url":"https://github.com/core-go/log","last_synced_at":"2026-03-05T07:03:06.429Z","repository":{"id":44409083,"uuid":"298549494","full_name":"core-go/log","owner":"core-go","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-28T11:18:59.000Z","size":98,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-17T20:45:21.826Z","etag":null,"topics":["log","logging","logrus","middleware","middleware-log","zap"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/core-go.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2020-09-25T11:08:58.000Z","updated_at":"2024-09-01T13:45:32.000Z","dependencies_parsed_at":"2024-04-11T06:31:27.799Z","dependency_job_id":"d6a0f4fb-e178-4a24-85aa-4e597558c356","html_url":"https://github.com/core-go/log","commit_stats":null,"previous_names":["common-go/log"],"tags_count":16,"template":false,"template_full_name":null,"purl":"pkg:github/core-go/log","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/core-go%2Flog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/core-go%2Flog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/core-go%2Flog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/core-go%2Flog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/core-go","download_url":"https://codeload.github.com/core-go/log/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/core-go%2Flog/sbom","scorecard":{"id":304683,"data":{"date":"2025-08-11","repo":{"name":"github.com/core-go/log","commit":"159ec1677dc4d967c17572e873178c87a894ac24"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Code-Review","score":0,"reason":"Found 0/30 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}}]},"last_synced_at":"2025-08-17T21:44:32.684Z","repository_id":44409083,"created_at":"2025-08-17T21:44:32.684Z","updated_at":"2025-08-17T21:44:32.684Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30113121,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T03:40:26.266Z","status":"ssl_error","status_checked_at":"2026-03-05T03:39:15.902Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6: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":["log","logging","logrus","middleware","middleware-log","zap"],"created_at":"2024-11-11T17:18:47.437Z","updated_at":"2026-03-05T07:03:06.411Z","avatar_url":"https://github.com/core-go.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# log\n- wrapper of [zap](https://pkg.go.dev/go.uber.org/zap)\n- wrapper of [logrus](https://github.com/sirupsen/logrus)\n- middleware tracing log for [Echo](https://github.com/labstack/echo), [Gin](https://github.com/gin-gonic/gin), or net/http ([Gorilla mux](https://github.com/gorilla/mux), [Go-chi](https://github.com/go-chi/chi))\n  - useful for Financial Products (to comply with \u003cb\u003ePCI-DSS\u003c/b\u003e standards) and Healthcare (to comply with \u003cb\u003eHIPAA\u003c/b\u003e regulations)\n\n\n- You can refer to [middleware-log-tracing](https://www.linkedin.com/pulse/middleware-log-tracing-go-duc-nguyen-uh0pc) at my [Linked In](https://vn.linkedin.com/in/duc-nguyen-437240239?trk=article-ssr-frontend-pulse_publisher-author-card) for more details.\n\n### A typical micro service\n- When you zoom one micro service, the flow is as below, and you can see \"log (zap, logrus)\" and \"middleware\" in the full picture:\n  ![A typical micro service](https://cdn-images-1.medium.com/max/800/1*d9kyekAbQYBxH-C6w38XZQ.png)\n\n## Content for logging\n### Request\n#### Features\n- \u003cb\u003eLog Request Method and URL\u003c/b\u003e: Log the HTTP method (GET, POST, etc.) and the requested URL.\n- \u003cb\u003eLog Request Headers\u003c/b\u003e: Option to log request headers for debugging purposes.\n- \u003cb\u003eLog Request Body\u003c/b\u003e: Option to log the request body (with configurable size limits to avoid logging large payloads).\n#### Benefits\n- \u003cb\u003eDebugging\u003c/b\u003e: Helps in tracing and debugging issues by providing complete information about incoming requests.\n- \u003cb\u003eMonitoring\u003c/b\u003e: Provides visibility into the types of requests being received.\n\n### Response\n#### Features\n- \u003cb\u003eLog Response Status Code\u003c/b\u003e: Log the HTTP status code of the response.\n- \u003cb\u003eLog Response Headers\u003c/b\u003e: Option to log response headers.\n- \u003cb\u003eLog Response Body\u003c/b\u003e: Option to log the response body (with configurable size limits to avoid logging large payloads).\n#### Benefits\n- \u003cb\u003eDebugging\u003c/b\u003e: Assists in diagnosing issues by providing complete information about the responses sent by the server.\n- \u003cb\u003eAuditing\u003c/b\u003e: Helps in auditing and reviewing server responses for compliance and monitoring purposes.\n\n### Response Time\n#### Features\n- \u003cb\u003eLog Response Time\u003c/b\u003e: Calculate and log the time taken to process each request.\n#### Benefits\n- \u003cb\u003ePerformance Monitoring\u003c/b\u003e: Helps in identifying slow requests and performance bottlenecks.\n- \u003cb\u003eOptimization\u003c/b\u003e: Provides data to optimize and improve server response times.\n\n### Response Size\n#### Features\n- \u003cb\u003eLog Response Size\u003c/b\u003e: Log the size of the response payload in bytes.\n#### Benefits\n- \u003cb\u003eBandwidth Monitoring\u003c/b\u003e: Helps in monitoring and managing bandwidth usage.\n- \u003cb\u003eOptimization\u003c/b\u003e: Provides insights into the response sizes to optimize payloads and improve performance.\n\n## Features\n### Middleware Integration\n#### Features\n- \u003cb\u003eMiddleware Function\u003c/b\u003e: Designed to integrate seamlessly with existing Go libraries: [Echo](https://github.com/labstack/echo), [Gin](https://github.com/gin-gonic/gin), or net/http ([Gorilla mux](https://github.com/gorilla/mux), [Go-chi](https://github.com/go-chi/chi)).\n  - Sample for [Echo](https://github.com/labstack/echo) is at [go-echo-sql-sample](https://github.com/go-tutorials/go-echo-sql-sample)\n  - Sample for [Gin](https://github.com/gin-gonic/gin) is at [go-gin-sql-sample](https://github.com/go-tutorials/go-gin-sql-sample)\n  - Sample for [Gorilla mux](https://github.com/gorilla/mux) is at [go-sql-sample](https://github.com/go-tutorials/go-sql-sample)\n- \u003cb\u003eContext Handling\u003c/b\u003e: Pass context to handle request-specific data throughout the middleware chain.\n#### Benefits\n- \u003cb\u003eEase of Use\u003c/b\u003e: Simplifies the integration of logging into existing web applications.\n- \u003cb\u003eConsistency\u003c/b\u003e: Ensures consistent logging across different parts of the application.\n\n### Logging Libraries Integration\n- Do not depend on any logging libraries.\n- Already supported to integrate with [zap](https://pkg.go.dev/go.uber.org/zap), [logrus](https://github.com/sirupsen/logrus)\n- Can be integrated with any logging library.\n\n### Enable/Disable Logging\n#### Features\n- \u003cb\u003eEnable/Disable Logging\u003c/b\u003e: Allow users to turn on or off logging for requests, responses, headers, and bodies independently.\n- \u003cb\u003eLogging Levels\u003c/b\u003e: Support different logging levels (e.g., INFO, DEBUG, ERROR) to control the verbosity of logs.\n#### Benefits\n- \u003cb\u003eFlexibility\u003c/b\u003e: Provides users with the flexibility to configure logging based on their needs and environment.\n- \u003cb\u003eEfficiency\u003c/b\u003e: Reduces overhead by allowing selective logging, especially in production environments.\n\n### Asynchronous Logging\n#### Features\n- \u003cb\u003eNon-Blocking Logs\u003c/b\u003e: Implement asynchronous logging to ensure that logging does not block request processing.\n- \u003cb\u003eLog Buffering\u003c/b\u003e: Use buffering to improve logging performance and reduce latency.\n#### Benefits:\n- \u003cb\u003ePerformance\u003c/b\u003e: Improves the overall performance of the application by reducing logging overhead.\n- \u003cb\u003eScalability\u003c/b\u003e: Allows the application to handle high-throughput logging without performance degradation.\n\n### Sensitive Data Encryption\n#### Features\n- Mask/Encrypt sensitive data in the request and response bodies.\n  - Sample for [Echo](https://github.com/labstack/echo) is at [go-echo-sql-sample](https://github.com/go-tutorials/go-echo-sql-sample)\n  - Sample for [Gin](https://github.com/gin-gonic/gin) is at [go-gin-sql-sample](https://github.com/go-tutorials/go-gin-sql-sample)\n  - Sample for [Gorilla mux](https://github.com/gorilla/mux) is at [go-sql-sample](https://github.com/go-tutorials/go-sql-sample)\n- Sensitive Data Identification: identify and encrypt specific fields in JSON payloads.\n\n#### Benefits:\n- \u003cb\u003eSecurity\u003c/b\u003e: Protects sensitive information from being exposed in logs.\n- \u003cb\u003eCompliance\u003c/b\u003e: Helps meet security and compliance requirements by safeguarding sensitive data.\n- \u003cb\u003eEase of Use\u003c/b\u003e: Simplifies the integration of encryption/masking into any existing applications.\n- \u003cb\u003eConsistency\u003c/b\u003e: Ensures that sensitive data is consistently encrypted or masked across all logged requests and responses\n\n## Use Cases of sensitive data masking/encrypting\n### Financial Transactions\n- \u003cb\u003eBenefit\u003c/b\u003e: Encrypting sensitive financial data, such as credit card numbers and transaction details, helps comply with PCI-DSS standards and secures financial transactions from exposure in logs.\n### Healthcare\n- \u003cb\u003eBenefit\u003c/b\u003e: Encrypting patient data such as medical records and health information in logs ensures compliance with HIPAA regulations and protects patient privacy.\n### E-commerce\n- \u003cb\u003eBenefit\u003c/b\u003e: Protecting customer information, such as addresses and payment details, enhances customer trust and protects the e-commerce platform from potential data breaches.\n\n## Benefits to Developers\n#### Enhanced Debugging\n- Provides detailed logs for requests and responses, aiding in troubleshooting and debugging issues.\n#### Performance Monitoring\n- Logs response times and sizes, allowing developers to monitor and optimize application performance.\n#### Flexibility\n- Configurable logging settings enable developers to tailor the logging behavior to their needs.\n#### Ease of Integration\n- Middleware function can be easily integrated into existing web frameworks, simplifying the setup process.\n#### Improved Maintainability\n- Centralized logging logic ensures consistency and makes the codebase easier to maintain.\n#### Security:\n- Encrypt or mask sensitive data in logs, reducing the risk of data exposure and meeting compliance requirements.\n\n## Conclusion\nBy implementing these features, you provide a comprehensive logging solution that enhances the visibility, performance, and maintainability of any GO applications.\n\n## Installation\nPlease make sure to initialize a Go module before installing core-go/log:\n\n```shell\ngo get -u github.com/core-go/log\n```\n\nImport:\n```go\nimport \"github.com/core-go/log\"\n```\n\n## Summary of middleware log tracing\n#### log tracing at middleware\nmiddleware log for\n- http\n- echo\n- gin\n##### Support to turn on, turn off\n- request\n- response\n- duration\n- http response status code\n- response content length\n##### Support to mask or encrypt fields\n- support to mask or encrypt fields, such as mobileNumber, creditCardNumber\n- useful for Financial Products (to comply with \u003cb\u003ePCI-DSS\u003c/b\u003e standards) and Healthcare (to comply with \u003cb\u003eHIPAA\u003c/b\u003e regulations)\n## Appendix\n### Microservice Architect\n![Microservice Architect](https://cdn-images-1.medium.com/max/800/1*vKeePO_UC73i7tfymSmYNA.png)\n\n### Cross-cutting concerns\n- \"log\" in the full picture of cross-cutting concerns\n  ![cross-cutting concerns](https://cdn-images-1.medium.com/max/800/1*y088T4NoJNrL9sqrKeSyqw.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcore-go%2Flog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcore-go%2Flog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcore-go%2Flog/lists"}