Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Add custom "big" section like "SPANTRACE" in color-eyre #194

Open
VorpalBlade opened this issue Aug 18, 2024 · 1 comment

Comments

@VorpalBlade
Copy link

When you use section in color-eyre it is added as a small section. E.g.

Error:
 0: Some context
 1: Root cause

Location:
   /home/arvid/src/paketkoll/crates/konfigkoll_script/src/engine.rs:240

My custom section with backtrace from embedded scripting language:
  0: somefunc()
  1: otherfunc()
  ...

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ SPANTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Big Rust spantrace

━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

Big rust backtrace here

Given that I have an embedded scripting language the user uses to customise my program I would like that custom section to have the same prominence as SPANTRACE and BACKTRACE. It is probably the most relevant section for the user. I can't find a way to add such prominent section in the API.

It would also be nice to be able to customise location to point to the script file (instead of the Rust location where I call into the scripting language VM).

It would also be good to be able to rename SPANTRACE and BACKTRACE to for example "Rust Spantrace" and "Rust Backtrace" to make it more clear to the user.

@VorpalBlade
Copy link
Author

Okay I found a workaround for part 1 of this:

mybacktrace
    .header( "  ━━━━━━━━━━━━━━━━━━━━━━━━ Rune Diagnostics and Backtrace ━━━━━━━━━━━━━━━━━━━━━━━━\n");

It very much feels like a hack though (especially with the leading spaces and trailing newline).

A cleaner solution would be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant