{"id":19893600,"url":"https://github.com/rzajac/zltest","last_synced_at":"2025-05-02T19:31:08.186Z","repository":{"id":53484602,"uuid":"301350833","full_name":"rzajac/zltest","owner":"rzajac","description":"Package zltest provides facilities to test zerolog log messages.","archived":false,"fork":false,"pushed_at":"2022-01-27T20:15:58.000Z","size":59,"stargazers_count":19,"open_issues_count":1,"forks_count":3,"subscribers_count":1,"default_branch":"master","last_synced_at":"2024-06-18T23:03:38.321Z","etag":null,"topics":["golang","testing","zerolog"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rzajac.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":"2020-10-05T09:07:05.000Z","updated_at":"2024-03-19T01:59:54.000Z","dependencies_parsed_at":"2022-08-26T15:22:55.547Z","dependency_job_id":null,"html_url":"https://github.com/rzajac/zltest","commit_stats":null,"previous_names":["rzajac/zlogtest"],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rzajac%2Fzltest","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rzajac%2Fzltest/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rzajac%2Fzltest/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rzajac%2Fzltest/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rzajac","download_url":"https://codeload.github.com/rzajac/zltest/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224328417,"owners_count":17293251,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["golang","testing","zerolog"],"created_at":"2024-11-12T18:30:04.036Z","updated_at":"2024-11-12T18:30:04.687Z","avatar_url":"https://github.com/rzajac.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Go Report Card](https://goreportcard.com/badge/github.com/rzajac/zltest)](https://goreportcard.com/report/github.com/rzajac/zltest)\n[![GoDoc](https://img.shields.io/badge/api-Godoc-blue.svg)](https://pkg.go.dev/github.com/rzajac/zltest)\n\nLogging is an integral part of most applications and as such it has tobe tested. \nPackage `zltest` provides facilities to test \n[zerolog](https://github.com/rs/zerolog) log messages.\n\nIn general `zltest.Tester` provides methods to test values (or existence) of\nspecific fields in logged messages.\n\n## Installation\n\n```\ngo get github.com/rzajac/zltest\n```\n\n## Examples\n\n```go\nfunc Test_ServiceLogsProperly(t *testing.T) {\n    // --- Given ---\n    // Crate zerolog test helper. \n    tst := zltest.New(t)\n\n    // Configure zerolog and pas tester as a writer.     \n    log := zerolog.New(tst).With().Timestamp().Logger()\n    \n    // Inject log to tested service or package.\n    srv := MyService(log)\n\n    // --- When ---\n    srv.ExecuteSomeLogic()\n\n    // --- Then ---\n\n    // Test if log messages were generated properly.\n    ent := tst.LastEntry()\n    ent.ExpNum(\"key0\", 123)\n    ent.ExpMsg(\"message\")\n    ent.ExpLevel(zerolog.ErrorLevel)\n}\n```\n\n## License\n\nBSD-2-Clause","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frzajac%2Fzltest","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frzajac%2Fzltest","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frzajac%2Fzltest/lists"}