File tree Expand file tree Collapse file tree
ProfCalculator/src/de/uulm/sp/swt/profcalculator Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package de .uulm .sp .swt .profcalculator ;
2+
3+ public class Logger {
4+
5+ private final static boolean LOGGING = true ;
6+
7+ private static Logger logger = new Logger ();
8+
9+ public Logger () {
10+ log ("Logging enabled:" );
11+ }
12+
13+ public static Logger getLogger () {
14+ return logger ;
15+ }
16+
17+ public void log (String message ) {
18+ if (LOGGING ) {
19+ System .out .println (message );
20+ }
21+ }
22+
23+ }
Original file line number Diff line number Diff line change @@ -54,9 +54,11 @@ public void handle(ActionEvent event) {
5454 int newValue = Integer .parseInt (inputField .getText ());
5555 if (event .getSource () == additionButton ) {
5656 expression = new Addition (expression , new Value (newValue ));
57+ Logger .getLogger ().log ("+ " + newValue );
5758 }
5859 else if (event .getSource () == multiplicationButton ) {
5960 expression = new Multiplication (expression , new Value (newValue ));
61+ Logger .getLogger ().log ("* " + newValue );
6062 }
6163 expression = new NecessaryBrackets (expression );
6264 updateGUI ();
You can’t perform that action at this time.
0 commit comments