Macro setup

Source
macro_rules! setup {
    ($metadata:expr, $replace:expr) => { ... };
    ($metadata:expr, $replace:expr, $template:literal) => { ... };
}
Expand description

Registers Crashlog’s panic handler.

The first argument is a metadata structure which provides information about the program which will be included in the crash log file and in the message printed to the user.

If the second argument, replace, is false, Crashlog’s panic handler will be appended to the current (or if none is set, the default) panic handler. If true, the current panic handler will be replaced.

The optional third argument allows you to specify a custom message to be printed to the user. This argument must be a string literal. It should use the regular std::fmt syntax for interpolating values. The fields of the metadata structure are all available as named arguments, as well as log_path, which represents the path of the crash log file. For example, "{package} crash log saved at {log_path}". If this argument is not given, DEFAULT_USER_MESSAGE_TEMPLATE is used.

With replace set to false:

$ westwood

thread 'main' panicked at src/main.rs:100:5:
explicit panic
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace


---

Uh oh! Westwood crashed.

A crash log was saved at the following path:
/var/folders/sr/kr0r9zfn6wj5pfw35xl47wlm0000gn/T/20ea72fca069a0b7.txt

To help us figure out why this happened, please report this crash.
Either open a new issue on GitHub [1] or send an email to the author(s) [2].
Attach the file listed above or copy and paste its contents into the report.

[1]: https://github.com/kdkasad/westwood/issues/new
[2]: Kian Kasad <kian@kasad.com>

For your privacy, we don't automatically collect any information, so we rely on
users to submit crash reports to help us find issues. Thank you!

With replace set to true:

$ westwood
Uh oh! Westwood crashed.

A crash log was saved at the following path:
/var/folders/sr/kr0r9zfn6wj5pfw35xl47wlm0000gn/T/20ea72fca069a0b7.txt

To help us figure out why this happened, please report this crash.
Either open a new issue on GitHub [1] or send an email to the author(s) [2].
Attach the file listed above or copy and paste its contents into the report.

[1]: https://github.com/kdkasad/westwood/issues/new
[2]: Kian Kasad <kian@kasad.com>

For your privacy, we don't automatically collect any information, so we rely on
users to submit crash reports to help us find issues. Thank you!