{"id":42609112,"url":"https://github.com/jucardi/go-logger-lib","last_synced_at":"2026-01-29T02:21:12.317Z","repository":{"id":57536390,"uuid":"133757508","full_name":"jucardi/go-logger-lib","owner":"jucardi","description":"Simple logger contract definition and encapsulation. Provides a factory and a logger interface to easily use any logger implementation desired.","archived":false,"fork":false,"pushed_at":"2021-07-20T22:05:41.000Z","size":35,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-27T20:30:48.852Z","etag":null,"topics":["go","golang","log","logger","loggerfactory","logging"],"latest_commit_sha":null,"homepage":null,"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/jucardi.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}},"created_at":"2018-05-17T04:11:22.000Z","updated_at":"2021-07-20T22:05:26.000Z","dependencies_parsed_at":"2022-08-29T00:40:28.027Z","dependency_job_id":null,"html_url":"https://github.com/jucardi/go-logger-lib","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/jucardi/go-logger-lib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jucardi%2Fgo-logger-lib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jucardi%2Fgo-logger-lib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jucardi%2Fgo-logger-lib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jucardi%2Fgo-logger-lib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jucardi","download_url":"https://codeload.github.com/jucardi/go-logger-lib/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jucardi%2Fgo-logger-lib/sbom","scorecard":{"id":540756,"data":{"date":"2025-08-11","repo":{"name":"github.com/jucardi/go-logger-lib","commit":"e196eeae2bbcd8607fd2abaa321a7696475c9835"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"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":"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":"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 0/27 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":"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":"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":"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":"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":"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":"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":-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"}},{"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":"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"}}]},"last_synced_at":"2025-08-20T08:09:07.827Z","repository_id":57536390,"created_at":"2025-08-20T08:09:07.827Z","updated_at":"2025-08-20T08:09:07.827Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28860813,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-28T22:56:21.783Z","status":"online","status_checked_at":"2026-01-29T02:00:06.714Z","response_time":59,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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","log","logger","loggerfactory","logging"],"created_at":"2026-01-29T02:21:11.645Z","updated_at":"2026-01-29T02:21:12.311Z","avatar_url":"https://github.com/jucardi.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# go-logger-lib\n\nIs a simple logger library which defines logger interfaces and factory to use a a contract to easily register and swap logger implementations affecting the behavior of a component.\n\nThis library is does not actually provide a logger implementation but instead by default uses a `github.com/sirupsen/logrus` standard logger instance as its default.\n\n## Getting started\n\nTo keep up to date with the most recent version:\n\n```bash\ngo get github.com/jucardi/go-logger-lib\n```\n\nTo get a specific version:\n\n```bash\ngo get gopkg.in/jucardi/go-logger-lib.v1\n```\n\n## What inspired me to create this simple library?\n\nWorking on a go project that I wanted to make open source, I realized that it would make sense to be able to have a logger and log information based on the results of certain operations. Originally I started using `github.com/sirupsen/logrus` which is a very good Go logging library, but I didn't want the consumers of my project to be forced to use `logrus` if they were already using a different logger.\n\nA generic logger interface enabled me to use it in the project and easily give the freedom to any consumer to simply plug in any logger implementation they feel comfortable using (if any) while still continuing to provide the option for output logs that can be adapted to their stack.\n\n## The `ILogger` interface\nThe `ILogger` interface was thought of by using the most commonly function names for loggers. It exposes the following functions\n\n```Go\ntype ILogger interface {\n    // SetLevel sets the logging level\n    SetLevel(level Level)\n    // GetLevel gets the logging level\n    GetLevel() Level\n\n    // Debug logs a message at level Debug on the logger.\n    Debug(args ...interface{})\n    // Debugf logs a message at level Debug on the logger.\n    Debugf(format string, args ...interface{})\n    // Debugln logs a message at level Debug on the logger.\n    Debugln(args ...interface{})\n\n    // Info logs a message at level Info on the logger.\n    Info(args ...interface{})\n    // Infof logs a message at level Info on the logger.\n    Infof(format string, args ...interface{})\n    // Infoln logs a message at level Info on the logger.\n    Infoln(args ...interface{})\n\n    // Warn logs a message at level Warn on the logger.\n    Warn(args ...interface{})\n    // Warnf logs a message at level Warn on the logger.\n    Warnf(format string, args ...interface{})\n    // Warnln logs a message at level Warn on the logger.\n    Warnln(args ...interface{})\n\n    // Error logs a message at level Error on the logger.\n    Error(args ...interface{})\n    // Errorf logs a message at level Error on the logger.\n    Errorf(format string, args ...interface{})\n    // Errorln logs a message at level Error on the logger.\n    Errorln(args ...interface{})\n\n    // Fatal logs a message at level Fatal on the logger.\n    Fatal(args ...interface{})\n    // Fatalf logs a message at level Fatal on the logger.\n    Fatalf(format string, args ...interface{})\n    // Fatalln logs a message at level Fatal on the logger.\n    Fatalln(args ...interface{})\n\n    // Panic logs a message at level Panic on the logger.\n    Panic(args ...interface{})\n    // Panicf logs a message at level Panic on the logger.\n    Panicf(format string, args ...interface{})\n    // Panicln logs a message at level Panic on the logger.\n    Panicln(args ...interface{})\n}\n```\n\n## The factory\nSimply provides the following functions\n\n* `New(name string, writer ...io.Writer) ILogger`: Creates a new logger instance using the default builder assigned.\n  * `name`: The name of the logger to create.\n  * `writer`: (Optional) The io.Writer the logger instance should use. If not provided, it is set to the default writer by the implementation, typically Stdout or Stderr\n* `Register(name string, logger ILogger)`: Registers an instance of ILogger to be returned as the singleton instance by the given name.\n  * `name`: The logger name.\n  * `logger`: The logger instance.\n* `Get(name string) ILogger`: Returns an instance of the requested logger by its name. Creates a new logger with the default logger builder if the logger does not exist.\n  * `name`: The name of the logger instance to be retrieved.\n* `List() []string`: Returns the list of loggers that have been registered.\n* `Contains(name string) bool`: Indicates if a logger by the given name exists.\n* `SetDefaultBuilder(ctor LoggerBuilder)` Assigns a new constructor function to use as the default logger constructor.\n\n## Predefined logger types\n\n* **Logrus**: Predefined logger implementation powered by `github.com/sirupsen/logrus`. It is assigned as default to be de default logger which responds to the static functions in the `log` package. Can also be obtained by the using the `\"logrus\"` name (also defined in the `LoggerLogrus` constant). Eg: `log.Get(log.LoggerLogrus)`\n* **Nil Logger**: This implementation, as the name suggests, is a logger that does nothing when its functions are called. Can be obtained by the using the `\"nil\"` name (also defined in the `LoggerNil` constant). Eg: `log.Get(log.LoggerNil)`. To easily set the Nil Logger as the default logger, simply pass `nil` value to the `log.SetDefault` function. Eg `log.SetDefault(nil)`\n\n## TODO\n\n* Do an implementation for the default Golang `log` package.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjucardi%2Fgo-logger-lib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjucardi%2Fgo-logger-lib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjucardi%2Fgo-logger-lib/lists"}