{"id":21478077,"url":"https://github.com/ichtrojan/thoth","last_synced_at":"2025-09-07T16:42:53.984Z","repository":{"id":57506381,"uuid":"231910381","full_name":"ichtrojan/thoth","owner":"ichtrojan","description":"An Error Logger for Go","archived":false,"fork":false,"pushed_at":"2020-04-06T16:56:24.000Z","size":38,"stargazers_count":32,"open_issues_count":0,"forks_count":9,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-06-18T17:16:21.063Z","etag":null,"topics":["error","error-handling","go","golang-package","logger","logging"],"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/ichtrojan.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-01-05T11:57:56.000Z","updated_at":"2024-01-17T09:33:43.000Z","dependencies_parsed_at":"2022-08-29T20:00:58.629Z","dependency_job_id":null,"html_url":"https://github.com/ichtrojan/thoth","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ichtrojan%2Fthoth","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ichtrojan%2Fthoth/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ichtrojan%2Fthoth/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ichtrojan%2Fthoth/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ichtrojan","download_url":"https://codeload.github.com/ichtrojan/thoth/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":226033200,"owners_count":17563126,"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":["error","error-handling","go","golang-package","logger","logging"],"created_at":"2024-11-23T11:16:30.498Z","updated_at":"2024-11-23T11:16:32.310Z","avatar_url":"https://github.com/ichtrojan.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Thoth\n\n![Thoth](https://res.cloudinary.com/ichtrojan/image/upload/v1585877110/Screenshot_2020-04-03_at_01.08.09_eg3ajk.png)\n\n## What is Thoth?\n\nIn Egyptian Mythology, Thoth was the Egyptian ibis-headed god of knowledge, magic and wisdom.\n\n### In this Context\n\nThoth is an error logger for golang. It helps log errors to a log file so you can go back to find how why and when something breaks in production.\n\n\n## Installation\n\nYou can install Thoth by running:\n\n```bash\ngo get github.com/ichtrojan/thoth\n```\n\n## Usage\n\nThoth supports logging to two filetypes:\n* log\n* json\n\n### Step one - Initiate Thoth\n\n#### Thoth Initiation for `log`\n\n```go\n...\nfile, err := thoth.Init(\"log\")\n\nif err != nil {\n    log.Fatal(err)\n}\n...\n```\n\n#### Thoth Initiation for `json`\n\n```go\n...\njson, err := thoth.Init(\"json\")\n\nif err != nil {\n    log.Fatal(err)\n}\n...\n```\n\n### Step two - Log errors\n\nRegardless of the variable assigned to a Thoth `Init` function and log format; errors can be logged using the `Log` function.\n\n#### Thoth Initiation for `log`\n\n**Logging errors from packages**\n\n```go\n...\nif err != nil {\n    file.Log(err)\n}\n...\n```\n\n**Logging custom errors based on a given condition**\n\n```go\n...\nisBroke := true\n\nif isBroke {\n    file.Log(errors.New(\"something went wrong\"))\n}\n...\n```\n\n#### Thoth Initiation for `json`\n\n**Logging errors from packages**\n\n```go\n...\nif err != nil {\n    json.Log(err)\n}\n...\n```\n\n**Logging custom errors based on a given condition**\n\n```go\n...\nhigh := true\n\nif high {\n    json.Log(errors.New(\"highest in the room\"))\n}\n...\n```\n\n### Step three - Serve real-time logs dashboard\n\nYou can serve a dashboard to view your logs in realtime using the `Serve` function. Depending on the filetype specified in the `Init` function, it will serve the content of your log file.\n\n#### Usage format\n\n```go\nfile.Serve({dashboard route}, {dashboard password})\n```\n\n#### Thoth serve for `log`\n\n```go\n...\nif err := file.Serve(\"/logs\", \"12345\"); err != nil {\n    log.Fatal(err)\n}\n\nif err := http.ListenAndServe(\":8000\", nil); err != nil {\n    file.Log(err)\n}\n...\n```\n\nThe snippet above will serve your realtime log dashboard on port `8000` and can be visited on `/logs` route.\n\nYou can also check the [example](https://github.com/ichtrojan/thoth/tree/master/example) directory to see a sample usage.\n\n\u003e**NOTE**\n\u003eThe realtime dashboard for `json` is currently on beta, it can be used but still looks experimental.\n\n## Contributors\n\n* Elvis Chuks - [GitHub](https://github.com/elvis-chuks) [Twitter](https://twitter.com/ElvisChuks15)\n* Jude Dike - [GitHub](https://github.com/dumebi) [Twitter](https://twitter.com/bigbrutha_)\n* Trojan Okoh - [GitHub](https://github.com/ichtrojan) [Twitter](https://twitter.com/ichtrojan)\n\n## Conclusion\n\nContributions are welcome to this project to further improve it to suit the general public need. I hope you enjoy the simplicity of Thoth and cannot wait to see the wonderful project you build with it.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fichtrojan%2Fthoth","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fichtrojan%2Fthoth","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fichtrojan%2Fthoth/lists"}