Skip to content

Commit 2e25f30

Browse files
authored
Update LoggingCalculatorDecorator.java
1 parent f779944 commit 2e25f30

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

core-java-modules/core-java-lang-oop-patterns-2/src/main/java/com/baeldung/overridemethod/decorator/LoggingCalculatorDecorator.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ public int add(int a, int b) {
2222

2323
@Override
2424
public int subtract(int a, int b) {
25-
// Just delegate
26-
return wrappedCalculator.subtract(a, b);
25+
log.debug("DECORATOR LOG: Entering subtract({}, {})", a, b);
26+
int result = wrappedCalculator.subtract(a, b); // Delegation
27+
log.debug("DECORATOR LOG: Exiting subtract. Result: {}", result);
28+
return result;
2729
}
2830
}

0 commit comments

Comments
 (0)