{"id":41374262,"url":"https://github.com/darklab8/go-typelog","last_synced_at":"2026-01-23T09:58:37.912Z","repository":{"id":219448723,"uuid":"749074626","full_name":"darklab8/go-typelog","owner":"darklab8","description":"Static typed structured logging lib","archived":false,"fork":false,"pushed_at":"2025-05-11T07:24:44.000Z","size":44,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-11T08:27:09.119Z","etag":null,"topics":[],"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/darklab8.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,"zenodo":null}},"created_at":"2024-01-27T14:14:32.000Z","updated_at":"2025-05-11T07:24:23.000Z","dependencies_parsed_at":"2025-04-13T18:24:26.702Z","dependency_job_id":"d4514b56-3d9c-42fe-b320-4351a52a62f0","html_url":"https://github.com/darklab8/go-typelog","commit_stats":null,"previous_names":["darklab8/logusgo"],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/darklab8/go-typelog","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darklab8%2Fgo-typelog","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darklab8%2Fgo-typelog/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darklab8%2Fgo-typelog/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darklab8%2Fgo-typelog/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/darklab8","download_url":"https://codeload.github.com/darklab8/go-typelog/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/darklab8%2Fgo-typelog/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28687413,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-23T05:48:07.525Z","status":"ssl_error","status_checked_at":"2026-01-23T05:48:07.129Z","response_time":59,"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":"2026-01-23T09:58:37.226Z","updated_at":"2026-01-23T09:58:37.900Z","avatar_url":"https://github.com/darklab8.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PROJECT IS MIGRATED\n\nto https://github.com/darklab8/go-utils . For convinience of not dealing with too much repositories.\n\n# Typelog - Static typed structured logging\n\n## Description\n\nThis project araised from the need to log backend applications, aws lambdas and other stuff in modern cloud ecosystem. Logging systems today are able easily parsing JSON format out of the box.\nStatic typing approach brings here consistent way to define key values to final msg, as well as easier following Domain Driven Design, where logs consistently describe what they log. Static typed logging brings easy refactoring to any present logs.\n\n## Features\n\n- Accepts static typed components as optional params\n  - it will not accept `any` options as slog.\n  - has shortcut WithFields, to make clone of the logger with default logging fields\n- Easy to turn on/off parameters by environment variables\n  - Ability to define different log levels for different created loggers\n- Easier turning complex objects into structured logging\n  - accepts maps and structs as its params. It will parse them on their own.\n- has ability to show \"scope\" of current logging (from which module the logs are)\n- has ability to grab otlp span id/trace id if they are present\n\n[See folder examples](./examples)\n\n## Alternative Versions\n\n- [Version in python](https://github.com/darklab8/py-typelog)\n\n## How to use\n\ninstall with `go get github.com/darklab8/go-typelog`\n\nexamples/logger/main.go\n```go\npackage logger\n\nimport \"github.com/darklab8/go-typelog/typelog\"\n\nvar Log *typelog.Logger = typelog.NewLogger(\"typelog\")\n```\n\nexamples/params_test.go\n```go\npackage examples\n\nimport (\n\t\"log/slog\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/darklab8/go-typelog/examples/logger\"\n\t\"github.com/darklab8/go-typelog/typelog\"\n)\n\nfunc TestUsingInitialized(t *testing.T) {\n\n\tlogger.Log.Debug(\"123\")\n\n\tlogger.Log.Debug(\"123\", typelog.TestParam(456))\n\n\tlogger1 := logger.Log.WithFields(typelog.Int(\"worker_id\", 10))\n\n\tlogger1.Info(\"Worker made action1\")\n\tlogger1.Info(\"Worker made action2\")\n\n\tlogger2 := logger.Log.WithFields(typelog.Float64(\"smth\", 13.54))\n\tlogger2.Debug(\"try now\")\n\tlogger1.Info(\"Worker made action1\", typelog.Bool(\"is_check\", false))\n}\n\nfunc TestSlogging(t *testing.T) {\n\n\tlogger := typelog.NewLogger(\"test\", typelog.WithLogLevel(typelog.LEVEL_DEBUG))\n\tlogger.Debug(\"123\")\n\n\tlogger.Debug(\"123\", typelog.TestParam(456))\n}\n\nfunc NestedParam(value string) typelog.LogType {\n\treturn func(c *typelog.LogAtrs) {\n\t\tc.Append(typelog.Group(\"nested\", typelog.TurnMapToAttrs(map[string]any{\n\t\t\t\"smth\":   \"abc\",\n\t\t\t\"number\": 123,\n\t\t})...))\n\t}\n}\n\ntype Smth struct {\n\tValue1  string\n\tNumber1 int\n}\n\nfunc NestedStructParam(value string) typelog.LogType {\n\treturn func(c *typelog.LogAtrs) {\n\t\tc.Append(\n\t\t\ttypelog.Group(\"nested\", typelog.TurnStructToAttrs(Smth{Value1: \"123\", Number1: 4})...),\n\t\t\tslog.Int(\"not_nested\", 345),\n\t\t)\n\t}\n}\n\nfunc TestNested(t *testing.T) {\n\tlogger := typelog.NewLogger(\"test\", typelog.WithLogLevel(typelog.LEVEL_DEBUG), typelog.WithJsonFormat(true))\n\n\tlogger.Debug(\"123\", NestedParam(\"abc\"))\n\tlogger.Debug(\"456\", NestedStructParam(\"abc\"))\n}\n\nfunc TestCopyingLoggers(t *testing.T) {\n\tlogger := typelog.NewLogger(\"test\", typelog.WithLogLevel(typelog.LEVEL_DEBUG), typelog.WithJsonFormat(true))\n\n\tlogger1 := logger.WithFields(typelog.String(\"smth\", \"123\"))\n\tlogger2 := logger1.WithFields(typelog.Int(\"smth2\", 2), typelog.String(\"anotheparam\", \"abc\"))\n\tlogger3 := logger2.WithFields(typelog.Time(\"smth3\", time.Now()))\n\n\tlogger1.Info(\"logger1 printed\")\n\tlogger2.Info(\"logger2 printed\")\n\tlogger3.Info(\"logger3 printed\")\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarklab8%2Fgo-typelog","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdarklab8%2Fgo-typelog","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdarklab8%2Fgo-typelog/lists"}