`home-prelude` is a Rust library designed to simplify the setup of tracing and error handling for Rust applications. It provides pre-configured tracing and error output configurations that can be quickly integrated into binary projects, especially those intended to run in a home or personal environment. ## Features - **Pre-configured Tracing**: Set up tracing with sensible defaults, including custom time formatting, ANSI color support, and panic hooks. - **Enhanced Error Reporting**: Leverage `color-eyre` for better error reporting. - **Unified Error Type**: Use the `StdResult` type alias for consistent error handling across your application. ## Getting Started ### Installation Add `home-prelude` to your `Cargo.toml`: ```toml [dependencies] home-prelude = "1" ``` ### Usage To use `home-prelude` in your Rust project, you need to set up tracing and error handling at the start of your application: ```rust use home_prelude::{configure_tracing, configure_color_eyre, StdResult}; fn main() -> StdResult { // Configure tracing and error handling configure_tracing(); configure_error_output(); // Your application logic goes here Ok(()) } ``` ### Configuration Details - **Tracing Configuration**: - Tracing output is sent to `stderr`. - Custom time format (`%Y-%m-%d %H:%M:%S`) for log timestamps. - Optionally disables ANSI colors based on the `NO_COLOR` environment variable. - Disables the inclusion of thread names, thread IDs, target, file, and line numbers in logs for cleaner output. - **Error Handling Configuration**: - Integrates `color-eyre` for enhanced error reporting. - Automatically switches between color themes based on the presence of the `NO_COLOR` environment variable. ## Contributing Contributions are welcome! Please check out the [issues](https://github.com/haribo256/home-prelude/issues) for tasks to work on. If you find a bug or have a feature request, feel free to open an issue. ## Acknowledgments - This library is built on top of the great work from the Rust community, especially the creators and maintainers of `tracing`, `color-eyre`, and other dependencies. ## License This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for more details. ## Contact For any questions or support, please open an issue or contact the maintainer via the repository's [homepage](https://github.com/haribo256/home-prelude).