{"id":24302873,"url":"https://github.com/digipolitan/perfect-time-wrap","last_synced_at":"2026-06-10T07:31:12.090Z","repository":{"id":98675606,"uuid":"93261956","full_name":"Digipolitan/perfect-time-wrap","owner":"Digipolitan","description":"HTTP request logger middleware for perfect swift","archived":false,"fork":false,"pushed_at":"2017-06-05T10:02:15.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-06T14:31:33.480Z","etag":null,"topics":["logger","middleware","perfect","perfect-server","swift"],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Digipolitan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","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":"2017-06-03T16:58:05.000Z","updated_at":"2017-09-29T11:53:54.000Z","dependencies_parsed_at":"2023-04-14T01:46:53.178Z","dependency_job_id":null,"html_url":"https://github.com/Digipolitan/perfect-time-wrap","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/Digipolitan/perfect-time-wrap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Digipolitan%2Fperfect-time-wrap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Digipolitan%2Fperfect-time-wrap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Digipolitan%2Fperfect-time-wrap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Digipolitan%2Fperfect-time-wrap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Digipolitan","download_url":"https://codeload.github.com/Digipolitan/perfect-time-wrap/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Digipolitan%2Fperfect-time-wrap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34142637,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-10T02:00:07.152Z","response_time":89,"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":["logger","middleware","perfect","perfect-server","swift"],"created_at":"2025-01-17T00:19:57.840Z","updated_at":"2026-06-10T07:31:12.070Z","avatar_url":"https://github.com/Digipolitan.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"PerfectTimeWrap\n=================================\n\n[![Twitter](https://img.shields.io/badge/twitter-@Digipolitan-blue.svg?style=flat)](http://twitter.com/Digipolitan)\n\nPerfect TimeWrap middleware swift is a request logger\n\n## Installation\n\n### Swift Package Manager\n\nTo install PerfectTimeWrap with SPM, add the following lines to your `Package.swift`.\n\n```swift\nimport PackageDescription\n\nlet package = Package(\n    name: \"XXX\",\n    dependencies: [\n        .Package(url: \"https://github.com/Digipolitan/perfect-time-wrap-swift.git\", majorVersion: 1)\n    ]\n)\n```\n\n## The Basics\n\nCreate a RouterMiddleware and register the TimeWrap middleware as follow\n\n```swift\nlet server = HTTPServer()\n\nlet router = RouterMiddleware()\n\nTimeWrap.use(in: router)\n\nrouter.get(path: \"/hello\").bind { (context) in\n  context.response.setBody(string: \"Hello world !\").completed()\n  context.next()\n}\n\nserver.use(router: router)\n\nserver.serverPort = 8888\n\ndo {\n    try server.start()\n    print(\"Server listening on port \\(server.serverPort)\")\n} catch PerfectError.networkError(let err, let msg) {\n    print(\"Network error thrown: \\(err) \\(msg)\")\n}\n```\nWhen a user access to the route `/hello`, TimeWrap will log on the console :\n`[INFO] GET /hello 200 OK 0.196 ms`\n\n## Advanced\n\nIt's possible to register a specific handler to log as follow :\n```swift\nTimeWrap.use(in: router, options: .init { info, request, response in\n    return \"My special formatter \\(info.duration())ms on \\(request.path)\"\n })\n```\nWhen a user access to the route `/hello`, TimeWrap will log on the console :\n`[INFO] My special formatter 0.150978565216064ms on /hello`\n\n## Contributing\n\nSee [CONTRIBUTING.md](CONTRIBUTING.md) for more details!\n\nThis project adheres to the [Contributor Covenant Code of Conduct](CODE_OF_CONDUCT.md).\nBy participating, you are expected to uphold this code. Please report\nunacceptable behavior to [contact@digipolitan.com](mailto:contact@digipolitan.com).\n\n## License\n\nPerfectTimeWrap is licensed under the [BSD 3-Clause license](LICENSE).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigipolitan%2Fperfect-time-wrap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdigipolitan%2Fperfect-time-wrap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdigipolitan%2Fperfect-time-wrap/lists"}