{"id":15571001,"url":"https://github.com/netromdk/tracepp","last_synced_at":"2025-04-09T17:14:14.961Z","repository":{"id":75034308,"uuid":"188424562","full_name":"netromdk/tracepp","owner":"netromdk","description":"C++17 tracing library for debugging with ease.","archived":false,"fork":false,"pushed_at":"2019-05-29T17:19:53.000Z","size":313,"stargazers_count":7,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-09T17:14:02.914Z","etag":null,"topics":["cpp","cpp17","debugging-tool","include-only","traceability"],"latest_commit_sha":null,"homepage":"","language":"C++","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/netromdk.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}},"created_at":"2019-05-24T13:15:14.000Z","updated_at":"2024-12-24T20:47:00.000Z","dependencies_parsed_at":null,"dependency_job_id":"8d5fa7ac-ca1b-49e2-9ca1-9871dab9c11a","html_url":"https://github.com/netromdk/tracepp","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netromdk%2Ftracepp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netromdk%2Ftracepp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netromdk%2Ftracepp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/netromdk%2Ftracepp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/netromdk","download_url":"https://codeload.github.com/netromdk/tracepp/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248074933,"owners_count":21043490,"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":["cpp","cpp17","debugging-tool","include-only","traceability"],"created_at":"2024-10-02T17:52:58.704Z","updated_at":"2025-04-09T17:14:14.935Z","avatar_url":"https://github.com/netromdk.png","language":"C++","readme":"# tracepp\nC++17 tracing library, via the `TRACE()` macro, for debugging with ease that is inspired by Rust's `dbg!` macro.\n\nIf `NDEBUG` is defined then `TRACE(x) x` in order for the program to function properly in non-debug mode.\n\n## Examples\nThe following example shows which values are checked in the `for`-loop and the values for each iteration:\n```c++\n#include \"tracepp.h\"\n\nint main()\n{\n  for (int i = 10; TRACE(i \u003c 13); ++i) {\n    TRACE(i);\n  }\n  return 0;\n}\n```\n\nOutput:\n```\nexample.cc:5:main(): i \u003c 13 = true\nexample.cc:6:main(): i = 10\nexample.cc:5:main(): i \u003c 13 = true\nexample.cc:6:main(): i = 11\nexample.cc:5:main(): i \u003c 13 = true\nexample.cc:6:main(): i = 12\nexample.cc:5:main(): i \u003c 13 = false\n```\n\nTracepp supports containers (as long as they have `cbegin()` and `cend()`):\n```c++\n#include \"tracepp.h\"\n#include \u003cvector\u003e\n\nint main()\n{\n  std::vector\u003cstd::vector\u003cint\u003e\u003e vec{{1, 2, 3}, {4, 5}, {6, 7, 8}};\n  TRACE(vec);\n  if (TRACE(vec.size() \u003e= 2)) {\n    TRACE(vec[1]);\n  }\n  return 0;\n}\n```\n\nOutput:\n```\nexample2.cc:7:main(): vec = [[1, 2, 3], [4, 5], [6, 7, 8]]\nexample2.cc:8:main(): vec.size() \u003e= 2 = true\nexample2.cc:9:main(): vec[1] = [4, 5]\n```\n\n## Adding custom type handling\nTracepp can easily be extended to support custom types:\n```c++\n#include \"tracepp.h\"\n#include \u003cstring\u003e\n\nstruct Custom {\n  Custom(const std::string \u0026text_) : text(text_) {}\n  std::string text;\n};\n\nnamespace tracepp {\n\ntemplate \u003c\u003e\ninline std::string toString(const Custom \u0026val)\n{\n  return \"\\\"\" + val.text + \"\\\"\";\n}\n\n} // namespace tracepp\n\nint main()\n{\n  Custom c(\"Hello, Custom World!\");\n  TRACE(c);\n  return 0;\n}\n```\n\nOutput:\n```\ncustom.cc:22:main(): c = \"Hello, Custom World!\"\n```\n\n## Overriding the default print function\nThe type of a print function is `tracepp::PrintFunc` and can be overridden using `tracepp::setPrintFunc()`:\n```c++\ntracepp::setPrintFunc([](const std::string \u0026file, const int line, const std::string \u0026func,\n                         const std::string \u0026expr, const std::string \u0026value) {\n  std::cout \u003c\u003c \"[CUSTOM] \" \u003c\u003c file \u003c\u003c \":\" \u003c\u003c line \u003c\u003c \":\" \u003c\u003c func \u003c\u003c \"(): \" \u003c\u003c expr \u003c\u003c \" = \"\n            \u003c\u003c value \u003c\u003c std::endl;\n});\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetromdk%2Ftracepp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetromdk%2Ftracepp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetromdk%2Ftracepp/lists"}