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

feat: MMLogger using parametrized message and string formatter #6591

Merged
merged 3 commits into from
Feb 23, 2025

Conversation

Scoppio
Copy link
Collaborator

@Scoppio Scoppio commented Feb 21, 2025

What it does?

Adds parametrized messages and string formatter to the MMLogger, and makes obvious when the error command will open a dialog screen with the error.

This also shows how to properly use the different ways to setup parameters for the logs

Copy link

codecov bot commented Feb 21, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 29.10%. Comparing base (1cc15a2) to head (a1dfbc7).
Report is 45 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #6591      +/-   ##
============================================
+ Coverage     29.04%   29.10%   +0.06%     
- Complexity    15180    15291     +111     
============================================
  Files          2837     2837              
  Lines        279411   279729     +318     
  Branches      49188    49288     +100     
============================================
+ Hits          81145    81421     +276     
+ Misses       192886   192854      -32     
- Partials       5380     5454      +74     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

verifyLog(Level.ERROR, "Error message: test");
}

@Test

Check notice

Code scanning / CodeQL

Deprecated method or constructor invocation Note

Invoking
MMLogger.error
should be avoided because it has been deprecated.
public void logMessage(String fqcn, Level level, org.apache.logging.log4j.Marker marker, String message, Throwable t) {
// Custom implementation for logging messages
}

Check notice

Code scanning / CodeQL

Confusing overloading of methods Note

Method CustomLogger.isEnabled(..) could be confused with overloaded method
isEnabled
, since dispatch depends on static types.
Method CustomLogger.isEnabled(..) could be confused with overloaded method
isEnabled
, since dispatch depends on static types.
public boolean isEnabled(Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7) {
return true;
}

Check notice

Code scanning / CodeQL

Confusing overloading of methods Note

Method CustomLogger.isEnabled(..) could be confused with overloaded method
isEnabled
, since dispatch depends on static types.
Method CustomLogger.isEnabled(..) could be confused with overloaded method
isEnabled
, since dispatch depends on static types.
Method CustomLogger.isEnabled(..) could be confused with overloaded method
isEnabled
, since dispatch depends on static types.
public boolean isEnabled(Level level, Marker marker, String message, Object p0, Object p1, Object p2, Object p3, Object p4, Object p5, Object p6, Object p7, Object p8, Object p9) {
return true;
}

Check notice

Code scanning / CodeQL

Confusing overloading of methods Note

Method CustomLogger.isEnabled(..) could be confused with overloaded method
isEnabled
, since dispatch depends on static types.
Method CustomLogger.isEnabled(..) could be confused with overloaded method
isEnabled
, since dispatch depends on static types.
Method CustomLogger.isEnabled(..) could be confused with overloaded method
isEnabled
, since dispatch depends on static types.
@Scoppio Scoppio self-assigned this Feb 21, 2025
Copy link
Collaborator

@rjhancock rjhancock left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to fix some JavaDocs and, since they are showing up, there are two spots within the Version.java file that are throwing CodeQL issues related to the fatal call.

Mind fixing those with the fataDialog instead along with this?

return;
}
automaticallyDismissDialog();
testMMLogger.errorDialog("test", "Error message: {}", "test");

Check warning

Code scanning / CodeQL

Unused format argument Warning

This format call refers to 0 argument(s) but supplies 1 argument(s).
@Scoppio Scoppio requested a review from rjhancock February 22, 2025 04:35
@Scoppio Scoppio added the Tests Issues or Pull Requests related to the project tests label Feb 22, 2025
@rjhancock rjhancock merged commit d064daf into MegaMek:master Feb 23, 2025
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Tests Issues or Pull Requests related to the project tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants