docs: add JavaDoc with example usage to all undocumented classes and non-private methods#30
Conversation
…on-private methods Agent-Logs-Url: https://github.com/microsphere-projects/microsphere-logging/sessions/e3fe6db3-b002-49d5-9298-701ad373b159 Co-authored-by: mercyblitz <533114+mercyblitz@users.noreply.github.com>
🤖 Augment PR SummarySummary: This PR adds missing JavaDoc across the microsphere-logging modules, standardizing documentation to include an Changes:
Technical Notes: Intended to be documentation-only with no behavioral changes; examples are embedded as inline code blocks under each documented API. 🤖 Was this summary useful? React with 👍 or 👎 |
| * <h3>Example Usage</h3> | ||
| * <pre>{@code | ||
| * Log4j2Logger logger = new Log4j2Logger("io.microsphere"); | ||
| * logger.debug("processing item: {}", item); |
There was a problem hiding this comment.
microsphere-log4j2/src/main/java/io/microsphere/logging/log4j2/Log4j2Logger.java:119 — This example calls logger.debug("processing item: {}", item), but Log4j2Logger#debug(String) only accepts a single String and this snippet won’t compile (and implies unsupported parameter substitution). Consider aligning the example with the wrapper API to avoid misleading users.
Severity: medium
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| * Logging logging = LoggingUtils.load(); | ||
| * LoggingMXBeanAdapter adapter1 = new LoggingMXBeanAdapter(logging); | ||
| * LoggingMXBeanAdapter adapter2 = new LoggingMXBeanAdapter(logging); | ||
| * boolean equal = adapter1.equals(adapter2); |
There was a problem hiding this comment.
microsphere-logging-commons/src/main/java/io/microsphere/logging/jmx/LoggingMXBeanAdapter.java:152 — The equals example suggests adapter1.equals(adapter2) might be meaningful, but equals() delegates to logging.equals(obj), so comparing to another adapter will likely return false. This could mislead users about the adapter’s equality semantics.
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
| */ | ||
| public void prepareInvocation(ExtensionContext context) { | ||
| } | ||
| } No newline at end of file |
There was a problem hiding this comment.
microsphere-logging-test/src/main/java/io/microsphere/logging/test/jupiter/extension/logging/LoggingLevelTemplateInvocationContext.java:120 — The diff indicates the file has no trailing newline (\ No newline at end of file), which can cause noisy diffs and tooling edge cases. Consider restoring the final newline.
Severity: low
🤖 Was this useful? React with 👍 or 👎, or 🚀 if it prevented an incident/outage.
Several classes and non-private methods across the codebase lacked JavaDoc entirely. All added JavaDoc includes an
<h3>Example Usage</h3>block with inline code examples.Changes by module
microsphere-logging-commons—LoggingMXBeanAdapter: constructor + all overridden methodsmicrosphere-log4j2—Log4j2Logger,Log4j2LoggerFactory,Log4j2Logging,Log4j2Utils(utility methods missing docs),InMemoryAppender(all lifecycle/accessor methods +findInMemoryAppender),LogEventComparator#compare,SmartFileAppenderLayout(constructor + interface methods),DelegatingLayout(constructors +getDelegate/setDelegate)microsphere-log4j—Log4jLogger,Log4jLoggerFactory,Log4jLoggingmicrosphere-logback—LogbackLoggingmicrosphere-java-logging—JavaLoggingmicrosphere-logging-test—LoggingLevelsRule,LoggingLevelsStatement,LoggingLevelsExtension(constructor + all non-private methods),LoggingLevelTemplateInvocationContext,LoggingLevelParameterResolver,LoggingLevelCallbackExample format applied consistently
No logic was changed — purely documentation additions.