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] Enum logging #20

Open
oh-yes-0-fps opened this issue Mar 28, 2024 · 1 comment
Open

[Feature] Enum logging #20

oh-yes-0-fps opened this issue Mar 28, 2024 · 1 comment

Comments

@oh-yes-0-fps
Copy link
Collaborator

oh-yes-0-fps commented Mar 28, 2024

We could allow implicit logging of enum types through annotations, Logged classes and any other way we publish data.

There are 2 approaches:

  • We generate a WPILib serializable struct on-the-fly for the enum using reflection and keep track of it as to not republish (not sure how possible this is)
  • We just log it as the name of the enum variant as a String

Example of what it would look like in Logged

  public default <E extends Enum<?>> void log(String key, E value, LogLevel level) {
    Monologue.ntLogger.put(getFullPath() + "/" + key, value.name(), level);
  }
@spacey-sooty
Copy link

FWIW I think this would be a good addition logging enums is always a pain when you don't have a simple annotation based way to do it

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

2 participants