{"id":36860255,"url":"https://github.com/usvc/go-logger","last_synced_at":"2026-01-12T14:49:27.894Z","repository":{"id":49977592,"uuid":"237958218","full_name":"usvc/go-logger","owner":"usvc","description":"A Go package to handle logging for web services and CLI tools","archived":false,"fork":false,"pushed_at":"2023-02-25T05:51:04.000Z","size":71,"stargazers_count":1,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-08-15T04:41:48.000Z","etag":null,"topics":["go","golang","golang-library","golang-package","logger","logging","logs"],"latest_commit_sha":null,"homepage":"","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/usvc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"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}},"created_at":"2020-02-03T12:19:37.000Z","updated_at":"2021-06-07T07:12:31.000Z","dependencies_parsed_at":"2024-06-21T13:07:51.684Z","dependency_job_id":"c9359977-404b-4057-8424-9f6932806122","html_url":"https://github.com/usvc/go-logger","commit_stats":null,"previous_names":["usvc/logger"],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/usvc/go-logger","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usvc%2Fgo-logger","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usvc%2Fgo-logger/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usvc%2Fgo-logger/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usvc%2Fgo-logger/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/usvc","download_url":"https://codeload.github.com/usvc/go-logger/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/usvc%2Fgo-logger/sbom","scorecard":{"id":912912,"data":{"date":"2025-08-11","repo":{"name":"github.com/usvc/go-logger","commit":"d2c3672effd18a4a8fd6aa966d3bac2bc925670f"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"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":"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":"Code-Review","score":0,"reason":"Found 1/29 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":"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":"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":0,"reason":"Project has not signed or included provenance with any releases.","details":["Warn: release artifact v0.6.3 not signed: https://api.github.com/repos/usvc/go-logger/releases/26363130","Warn: release artifact v0.6.2 not signed: https://api.github.com/repos/usvc/go-logger/releases/25882964","Warn: release artifact v0.6.1 not signed: https://api.github.com/repos/usvc/go-logger/releases/24955671","Warn: release artifact v0.6.0 not signed: https://api.github.com/repos/usvc/go-logger/releases/24955672","Warn: release artifact v0.5.0 not signed: https://api.github.com/repos/usvc/go-logger/releases/24751773","Warn: release artifact v0.6.3 does not have provenance: https://api.github.com/repos/usvc/go-logger/releases/26363130","Warn: release artifact v0.6.2 does not have provenance: https://api.github.com/repos/usvc/go-logger/releases/25882964","Warn: release artifact v0.6.1 does not have provenance: https://api.github.com/repos/usvc/go-logger/releases/24955671","Warn: release artifact v0.6.0 does not have provenance: https://api.github.com/repos/usvc/go-logger/releases/24955672","Warn: release artifact v0.5.0 does not have provenance: https://api.github.com/repos/usvc/go-logger/releases/24751773"],"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"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":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 2 are checked with a SAST tool"],"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":9,"reason":"1 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GO-2022-0493 / GHSA-p782-xgp4-8hr8"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-24T19:54:33.715Z","repository_id":49977592,"created_at":"2025-08-24T19:54:33.715Z","updated_at":"2025-08-24T19:54:33.715Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28340410,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"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":["go","golang","golang-library","golang-package","logger","logging","logs"],"created_at":"2026-01-12T14:49:27.627Z","updated_at":"2026-01-12T14:49:27.852Z","avatar_url":"https://github.com/usvc.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Logger\n\n[![latest release](https://badge.fury.io/gh/usvc%2Fgo-logger.svg)](https://github.com/usvc/go-logger/releases)\n[![build status](https://travis-ci.org/usvc/go-logger.svg?branch=master)](https://travis-ci.org/usvc/go-logger)\n[![pipeline status](https://gitlab.com/usvc/modules/go/logger/badges/master/pipeline.svg)](https://gitlab.com/usvc/modules/go/logger/-/commits/master)\n[![test coverage](https://api.codeclimate.com/v1/badges/3f00918cb5b964476dd0/test_coverage)](https://codeclimate.com/github/usvc/go-logger/test_coverage)\n[![maintainability](https://api.codeclimate.com/v1/badges/3f00918cb5b964476dd0/maintainability)](https://codeclimate.com/github/usvc/go-logger/maintainability)\n\nA Go package to handle logging for web services and CLI tools.\n\n\u003e This package wraps `github.com/sirupsen/logrus` and adds defaults so that creating a sensible logger is as easy as `logger.New()`\n\n| | |\n| --- | --- |\n| Github | [https://github.com/usvc/go-logger](https://github.com/usvc/go-logger) |\n| Gitlab | [https://gitlab.com/usvc/modules/go/logger](https://gitlab.com/usvc/modules/go/logger) |\n\n- - -\n\n- [Logger](#logger)\n- [Usage](#usage)\n  - [Importing](#importing)\n  - [Instantiating a basic logger](#instantiating-a-basic-logger)\n  - [Instantiating a logger without output](#instantiating-a-logger-without-output)\n  - [Instantiating a basic logger instance](#instantiating-a-basic-logger-instance)\n  - [Logging to stderr](#logging-to-stderr)\n  - [Logging to file system](#logging-to-file-system)\n  - [Logging to a buffer or custom io.Writer](#logging-to-a-buffer-or-custom-iowriter)\n  - [Logging in JSON](#logging-in-json)\n  - [Logging only Debug level and above](#logging-only-debug-level-and-above)\n  - [Logging with a custom field](#logging-with-a-custom-field)\n  - [Logging without levels](#logging-without-levels)\n- [Documentation](#documentation)\n  - [Configuration](#configuration)\n    - [logger.Options](#loggeroptions)\n  - [Constants](#constants)\n    - [Format](#format)\n    - [Level](#level)\n    - [Output](#output)\n    - [Type](#type)\n- [Example Application](#example-application)\n- [Development Runbook](#development-runbook)\n  - [Getting Started](#getting-started)\n  - [Continuous Integration (CI) Pipeline](#continuous-integration-ci-pipeline)\n- [License](#license)\n\n# Usage\n\n## Importing\n\n```go\nimport (\n  // ...\n  \"github.com/usvc/go-logger\"\n  // ...\n)\n```\n\n## Instantiating a basic logger\n\n```go\nlog := logger.New()\n```\n\n\n## Instantiating a logger without output\n\n```go\nlog := logger.New(logger.Options{\n  Type: logger.TypeNoOp,\n})\n```\n\n\n## Instantiating a basic logger instance\n\n```go\nlog := logger.NewLogrusEntry()\n```\n\n\n## Logging to `stderr`\n\n```go\nlog := logger.New(logger.Options{\n  Output: logger.OutputStderr,\n})\n```\n\n\n## Logging to file system\n\n```go\nlog := logger.New(logger.Options{\n  Output: logger.OutputStderr,\n  OutputFilePath: \"./20200223.log\",\n})\n```\n\n## Logging to a buffer or custom io.Writer\n\n```go\nvar output bytes.Buffer\nlog := logger.New(logger.Options{\n  Output: logger.OutputCustom,\n  OutputStream: \u0026output,\n})\n```\n\n## Logging in JSON\n\n```go\nlog := logger.New(logger.Options{\n  Format: logger.FormatJSON,\n})\n```\n\n## Logging only Debug level and above\n\n```go\nlog := logger.New(logger.Options{\n  Level: logger.LevelDebug,\n})\n```\n\n## Logging with a custom field\n\n```go\nlog := logger.New(logger.Options{\n  Fields: map[string]interface{}{\n    \"module\": \"main\",\n  },\n})\n```\n\n## Logging without levels\n\n```go\nlog := logger.New(logger.Options{\n  Type: logger.TypeStdout,\n})\n```\n\n- - -\n\n# Documentation\n\n## Configuration\n\n### `logger.Options`\n\n- **`Fields`** `map[string]interface{}`: Adds custom fields to the log entry.\n- **`Format`** `logger.Format`: One of `FormatJSON` or `FormatText`. Defaults to `FormatText`.\n- **`Level`** `logger.Level`: One of `LevelTrace`, `LevelDebug`, `LevelInfo`, `LevelWarn`, or `LevelError`. Defaults to `LevelTrace`.\n- **`Output`** `logger.Output`: One of `OutputCustom`, `OutputFileSystem`, `OutputStderr`, or `OutputStdout`. Defaults to `OutputStdout`.\n- **`OutputFilePath`** `string`: Path to a log file, defaults to using `os.Stdout` if file cannot be created. Only applicable when `Output` is set to `OutputFileSystem`\n- **`OutputStream`** `io.Writer`: Only applicable when `Output` is set to `OutputCustom`\n- **`Type`** `logger.Type`: One of `TypeLevelled` or `TypeStdout`. Defaults to `TypeLevelled`.\n\n## Constants\n\n### `Format`\n\nFormat defines how the logs output should be formatted.\n\n- **`FormatText`**: output plain text\n- **`FormatJSON`**: output JSON-formatted text\n\n### `Level`\n\nLevel defines the level of the logs.\n\n- **`LevelTrace`**: all other logs\n- **`LevelDebug`**: logs related to code execution\n- **`LevelInfo`**: logs related to business-flow success\n- **`LevelWarn`**: logs related to business-flow errors\n- **`LevelError`**: logs related to system-level failures\n\n### `Output`\n\nOutput defines where the logs should be streamed to.\n\n- **`OutputCustom`**: send logs to a custom `io.Writer`\n- **`OutputFileSystem`**: send logs to a file\n- **`OutputStderr`**: send logs to standard error\n- **`OutputStdout`**: send logs to standard output\n\n### `Type`\n\nType defines the type of logger desired.\n\n- **`TypeLevelled`**: defines a levelled logger\n- **`TypeNoOp`**: defines a silent logger\n- **`TypeStdout`**: defines a plaintext logger\n\n- - -\n\n# Example Application\n\nThe example application can be found at [`./cmd/logger`](./cmd/logger). To try it out from this repository, run `make run`.\n\nTo build it, run `make build_production`.\n\n- - -\n\n# Development Runbook\n\n## Getting Started\n\n1. Clone this repository\n2. Run `make deps` to pull in external dependencies\n3. Write some awesome stuff\n4. Run `make test` to ensure unit tests are passing\n5. Push\n\n## Continuous Integration (CI) Pipeline\n\nTo set up the CI pipeline in Gitlab:\n\n1. Run `make .ssh`\n2. Copy the contents of the file generated at `./.ssh/id_rsa.base64` into an environment variable named **`DEPLOY_KEY`** in **Settings \u003e CI/CD \u003e Variables**\n3. Navigate to the **Deploy Keys** section of the **Settings \u003e Repository \u003e Deploy Keys** and paste in the contents of the file generated at `./.ssh/id_rsa.pub` with the **Write access allowed** checkbox enabled\n\n- **`DEPLOY_KEY`**: generate this by running `make .ssh` and copying the contents of the file generated at `./.ssh/id_rsa.base64`\n\n# License\n\nCode here is licensed under the [MIT license](./LICENSE) by [@zephinzer](https://gitlab.com/zephinzer).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusvc%2Fgo-logger","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fusvc%2Fgo-logger","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fusvc%2Fgo-logger/lists"}