{"id":17949893,"url":"https://github.com/bblanchon/arduinotrace","last_synced_at":"2025-03-24T23:32:05.150Z","repository":{"id":73280223,"uuid":"141597271","full_name":"bblanchon/ArduinoTrace","owner":"bblanchon","description":"📓 A dead-simple tracing library to debug your Arduino programs","archived":false,"fork":false,"pushed_at":"2021-02-21T11:22:50.000Z","size":618,"stargazers_count":190,"open_issues_count":2,"forks_count":17,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-03-19T05:23:57.284Z","etag":null,"topics":["arduino","debugging","esp32","esp8266"],"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/bblanchon.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.md","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},"funding":{"github":"bblanchon","custom":["https://arduinojson.org/book/","https://paypal.me/benoitblanchon"]}},"created_at":"2018-07-19T15:17:59.000Z","updated_at":"2025-03-03T17:41:47.000Z","dependencies_parsed_at":"2023-09-19T15:47:46.046Z","dependency_job_id":null,"html_url":"https://github.com/bblanchon/ArduinoTrace","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bblanchon%2FArduinoTrace","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bblanchon%2FArduinoTrace/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bblanchon%2FArduinoTrace/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bblanchon%2FArduinoTrace/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bblanchon","download_url":"https://codeload.github.com/bblanchon/ArduinoTrace/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245372193,"owners_count":20604487,"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":["arduino","debugging","esp32","esp8266"],"created_at":"2024-10-29T09:35:11.032Z","updated_at":"2025-03-24T23:32:05.144Z","avatar_url":"https://github.com/bblanchon.png","language":"C++","funding_links":["https://github.com/sponsors/bblanchon","https://arduinojson.org/book/","https://paypal.me/benoitblanchon"],"categories":[],"sub_categories":[],"readme":"![A quote from Brian Kernighan](extras/img/banner.png)\n\nArduinoTrace\n============\n\n[![arduino-library-badge](https://www.ardu-badge.com/badge/ArduinoTrace.svg?version=1.2.0)](https://www.ardu-badge.com/ArduinoTrace/1.2.0)\n![Continuous Integration](https://github.com/bblanchon/ArduinoTrace/workflows/Continuous%20Integration/badge.svg)\n\nA dead-simple tracing library to debug your Arduino programs.\n\n## Example\n\nAll you need to do is call `TRACE()` or `DUMP(variable)`.\n\n```c++\n#include \u003cArduinoTrace.h\u003e\n\nint value = 0;\n\nvoid setup() {\n  Serial.begin(9600);\n  TRACE();\n}\n\nvoid loop() {\n  value++;\n  DUMP(value);\n  BREAK();\n}\n```\n\nThe program above would print:\n\n```text\nMyProgram.ino:7: void setup()\nMyProgram.ino:12: value = 1\nMyProgram.ino:13: BREAK! (press [enter] to continue)\nMyProgram.ino:12: value = 2\nMyProgram.ino:13: BREAK! (press [enter] to continue)\nMyProgram.ino:12: value = 3\nMyProgram.ino:13: BREAK! (press [enter] to continue)\n...\n```\n\n## Features\n\n* `TRACE()` prints:\n    - filename\n    - line number\n    - function's name\n    - function's parameters\n    - template parameters (if any)\n* `DUMP(variable)` prints:\n    - filename\n    - line number\n    - variable's name\n    - variable's value\n* `BREAK()` pauses the program until you send a line-break to the Serial\n* `TRACE()` and `DUMP(variable)` work at global scope, provided that you call `ARDUINOTRACE_INIT()` to initialize the Serial port.\n* Flushes the Serial port to make sure that each line is complete\n* Uses Flash memory when possible\n* Deduplicates strings a much as reasonable feasible\n* Header-only\n* Roughly 200 lines of code\n\n## A simple recipe to find where the code crashes\n\n1. sprinkle your code with `TRACE()` and `DUMP(variable)`\n2. run the program\n3. view all traces in the Serial monitor\n4. repeat the process until you find the line that causes the crash\n\n## Configuration\n\n| Setting                        | Default  | Description                                                                                                                                                                                                                                       |\n|:-------------------------------|:---------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `ARDUINOTRACE_ENABLE`          | `1`      | Determines whether the library is active. If set to `1`, ArduinoTrace is active, and prints traces to the serial port. Set this value to `0` to disable all the traces at once.                                                                   |\n| `ARDUINOTRACE_ENABLE_PROGMEM`  | `1`      | Determines whether the strings are stored in Flash or RAM. If defined to `1` (it's the default), ArduinoTrace places the string in the Flash memory to reduce the memory consumption. Only set this value to `0` if you have a compilation issue. |\n| `ARDUINOTRACE_ENABLE_FULLPATH` | `0`      | Determines how the filename is written. If set to `1`, ArduinoTrace prints the full path of the file. If set to `0`, ArduinoTrace only prints the filename.                                                                                       |\n| `ARDUINOTRACE_SERIAL`          | `Serial` | Define the serial port to use. Change this value to use an alternative serial port, for example, `SerialUSB`.                                                                                                                                     |\n\nTo change one of the settings above, you must define the symbol before including the library. For example:\n\n```c++\n#define ARDUINOTRACE_ENABLE 0  // Disable all traces\n#include \u003cArduinoTrace.h\u003e\n```\n\n## FAQ\n\n#### Is there a performance impact?\n\nOf course, there is! Your program will become fat and slow, so it's essential to use this \nlibrary only when debugging.\n\nYou should never use it in production.\n\nYou should never commit a program with traces.\n\n#### Does this library replace my logging library?\n\nAbsolutely not! Tracing and logging are different things.\n\nLogging is recording (possibly in an SD card) the important things that happen in a program so that we can do a post-mortem analysis, in case something goes wrong.\n\nTracing is recording every little step to narrow down the area of analysis when you're\nfixing a bug. It's a technique that you use for short periods of time, during a debugging session.\nAgain, you should not commit code that contains traces.\n\nIn short: logging is something you do in production, tracing is something you do while debugging.\n\n#### Why not use a debugger instead?\n\nSometimes, you cannot use a debugger.\nIn this case, you can always go back to the good-old tracing technique.\n\n#### And what about EspExceptionDecoder?\n\nEspExceptionDecoder is an awesome tool, but unfortunately, the results are not always accurate; you\noften see unrelated function names in the stack.\nI don't know why that happens (I guess it's due to compiler optimizations), but whatever the reason, it's still good to have a fallback option.\n\n## Tutorials\n\n* [ESP32 / ESP8266 Arduino: Debugging with the ArduinoTrace library](https://techtutorialsx.com/2018/10/11/esp32-esp8266-arduino-debugging-with-the-arduinotrace-library/) (`techtutorialsx.com`)\n* [ESP32 / ESP8266 ArduinoTrace: using the TRACE macro](https://techtutorialsx.com/2018/10/12/esp32-esp8266-arduinotrace-using-the-trace-macro/) (`techtutorialsx.com`)\n\n## Want to see how this library works?\n\n[![Youtube video: How to debug any Arduino program with tracing](extras/img/video-thumbnail.png)](https://youtu.be/JHMpszgzWSg)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbblanchon%2Farduinotrace","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbblanchon%2Farduinotrace","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbblanchon%2Farduinotrace/lists"}