-
Notifications
You must be signed in to change notification settings - Fork 613
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
[epilogue] Autogenerate nicer data names by default, not just raw element names #7167
base: main
Are you sure you want to change the base?
[epilogue] Autogenerate nicer data names by default, not just raw element names #7167
Conversation
eg "getFoo()" would now be logged as "Get Foo", or "m_leftMotor" as "Left Motor" It is now a compilation error to reuse the same logged name for multiple elements (since whatever is declared last would overwrite anything logged before it) Do not log record fields (just use the accessors). This also fixes an issue where records could never be logged due to identical member and accessor names
I believe changing the case of the field names is worse than logging the raw names. It could make it harder to quickly search for things in the advantage scope search bar. Removing suffixes isn't a terrible idea though. |
Could there be an option to opt out of the renaming behavior globally, or at the very least, an option to opt out when annotating a class with |
From what I understand, since field names are fetched only during compilation, this would still have to be an option within the Upon further consideration I don't think propagation is viable, as there is a possibility for loggers needing both implementations of renamed fields and raw field names depending on where the user is opting out within the dependency tree of loggers, and if there is any overlap. So opting out (or opting in) per-class seems like the only alternative, though maybe there's a different solution I'm not seeing. |
IIRC AdvantageScope uses fuzzy search, so it shouldn't be a problem. |
Yep, @Logged(autoName = ELEMENT_NAME)
class D {
double m_d; // logged as "m_d"
double getD() { ... } // logged as "getD"
}
@Logged(autoName = FOR_HUMANS)
class I {
int m_i; // logged as "I"
int getI() { ... } // Also logged as "I" - name collision and compilation error
} |
I don't the idea of having "Get" in log entries, could this change |
That's an error in my description - this does already remove the leading "get" from accessor methods. That's part of the reason why I made it an error to use the same name for multiple elements, otherwise a |
eg "getFoo()" will now be logged as "Foo", or "m_leftMotor" as "Left Motor"
It is now a compilation error to reuse the same logged name for multiple elements (since whatever is declared last would overwrite anything logged before it)
Do not log record fields (just use the accessors). This also fixes an issue where records could never be logged due to identical member and accessor names
Also skips
toString
,hashCode
, andclone
methods when generating loggers