A Crystal macro for puts-style debugging with colorized output, context, and type information.
debug.cr is a debugging macro for the Crystal programming language that enhances traditional print-based debugging. It provides colorized output, contextual information like file and line numbers, and type annotations for inspected values, making runtime value inspection quicker and more informative.
Crystal developers who prefer lightweight, print-style debugging over full debugger setups, especially those working on applications where quick runtime inspection is needed.
It offers a more feature-rich and visually organized alternative to basic `puts` statements, with zero runtime overhead when disabled, seamless integration into expressions, and extensive customization options for output formatting.
Debug macro for Crystal
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
Prints file name, line number, function name, and the original expression, making it easy to trace logged values, as demonstrated in the usage example with output showing these details.
Can be used inside expressions without breaking code flow, allowing debugging of complex calculations like in the factorial example without refactoring.
Debug calls become no-ops unless the DEBUG environment variable is set, ensuring no performance impact in production, as specified in the installation steps.
Offers configurable colors, path lengths, and logging settings through Debug.configure and Debug::Logger.configure, allowing tailored output for different needs.
Requires setting the DEBUG variable both during compilation and at runtime, adding complexity and potential for errors in deployment workflows, as noted in the installation instructions.
Lacks advanced features like step-through execution or breakpoints, making it unsuitable for deep debugging sessions where interactive control is needed.
The colorized and contextual output can become cluttered with many debug statements, potentially obscuring important logs in complex applications.