| 1 | package fi.eis.libraries.di; | |
| 2 | ||
| 3 | import java.io.PrintStream; | |
| 4 | import java.util.Date; | |
| 5 | ||
| 6 | public class SimpleLogger { | |
| 7 | public static enum LogLevel { | |
| 8 | NONE, ERROR, DEBUG; | |
| 9 | } | |
| 10 |
1
1. <init> : Removed assignment to member variable logLevel → KILLED |
private volatile LogLevel logLevel = LogLevel.NONE; |
| 11 | ||
| 12 | private final String className; | |
| 13 |
1
1. <init> : Removed assignment to member variable printStream → KILLED |
private transient PrintStream printStream = System.out; |
| 14 | ||
| 15 | public SimpleLogger(Class<?> targetClass) { | |
| 16 |
2
1. <init> : removed call to java/lang/Class::getName → SURVIVED 2. <init> : Removed assignment to member variable className → SURVIVED |
this.className = targetClass.getName(); |
| 17 | } | |
| 18 | public void setLogLevel(LogLevel value) { | |
| 19 |
1
1. setLogLevel : Removed assignment to member variable logLevel → KILLED |
this.logLevel = value; |
| 20 | } | |
| 21 | public boolean isDebugEnabled() { | |
| 22 | return this.logLevel.ordinal() >= LogLevel.DEBUG.ordinal(); | |
| 23 | } | |
| 24 | public boolean isErrorEnabled() { | |
| 25 | return this.logLevel.ordinal() >= LogLevel.ERROR.ordinal(); | |
| 26 | } | |
| 27 | | |
| 28 | public void debug(String message) { | |
| 29 | if (this.isDebugEnabled()) { | |
| 30 |
28
1. debug : removed call to java/util/Date::<init> → SURVIVED 2. debug : Substituted 3 with 4 → SURVIVED 3. debug : Substituted 0 with 1 → SURVIVED 4. debug : Substituted 1 with 0 → SURVIVED 5. debug : Substituted 0 with 1 → SURVIVED 6. debug : Substituted 2 with 1 → SURVIVED 7. debug : Substituted 1 with 0 → SURVIVED 8. debug : Substituted 2 with 0 → SURVIVED 9. debug : Substituted 3 with 4 → SURVIVED 10. debug : Substituted 0 with 1 → SURVIVED 11. debug : Substituted 1 with 2 → SURVIVED 12. debug : Substituted 1 with 0 → SURVIVED 13. debug : Substituted 2 with 1 → SURVIVED 14. debug : Substituted 2 with 3 → KILLED 15. debug : removed call to java/io/PrintStream::printf → KILLED 16. debug : replaced call to java/io/PrintStream::printf with receiver → KILLED 17. debug : Substituted 3 with 1 → KILLED 18. debug : Substituted 3 with 0 → KILLED 19. debug : Substituted 3 with -1 → KILLED 20. debug : Substituted 0 with -1 → KILLED 21. debug : Substituted 1 with -1 → KILLED 22. debug : Substituted 2 with -1 → KILLED 23. debug : Substituted 3 with -3 → KILLED 24. debug : Substituted 1 with -1 → KILLED 25. debug : Substituted 2 with -2 → KILLED 26. debug : Substituted 2 with 3 → KILLED 27. debug : Substituted 3 with 2 → KILLED 28. debug : Substituted 0 with -1 → KILLED |
printStream.printf("%s DEBUG %s: %s%n", |
| 31 | new Date(), className, message); | |
| 32 | } | |
| 33 | } | |
| 34 | public void debug(String message, Object... parameters) { | |
| 35 | if (this.isDebugEnabled()) { | |
| 36 | debug(String.format(message, parameters)); | |
| 37 | } | |
| 38 | } | |
| 39 | public void error(String message) { | |
| 40 | if (this.isErrorEnabled()) { | |
| 41 |
28
1. error : removed call to java/util/Date::<init> → SURVIVED 2. error : Substituted 3 with 4 → SURVIVED 3. error : Substituted 0 with 1 → SURVIVED 4. error : Substituted 1 with 0 → SURVIVED 5. error : Substituted 0 with 1 → SURVIVED 6. error : Substituted 2 with 1 → SURVIVED 7. error : Substituted 1 with 0 → SURVIVED 8. error : Substituted 2 with 0 → SURVIVED 9. error : Substituted 3 with 4 → SURVIVED 10. error : Substituted 0 with 1 → SURVIVED 11. error : Substituted 1 with 2 → SURVIVED 12. error : Substituted 1 with 0 → SURVIVED 13. error : Substituted 2 with 1 → SURVIVED 14. error : Substituted 2 with 3 → KILLED 15. error : removed call to java/io/PrintStream::printf → KILLED 16. error : replaced call to java/io/PrintStream::printf with receiver → KILLED 17. error : Substituted 3 with 1 → KILLED 18. error : Substituted 3 with 0 → KILLED 19. error : Substituted 3 with -1 → KILLED 20. error : Substituted 0 with -1 → KILLED 21. error : Substituted 1 with -1 → KILLED 22. error : Substituted 2 with -1 → KILLED 23. error : Substituted 3 with -3 → KILLED 24. error : Substituted 1 with -1 → KILLED 25. error : Substituted 2 with -2 → KILLED 26. error : Substituted 2 with 3 → KILLED 27. error : Substituted 3 with 2 → KILLED 28. error : Substituted 0 with -1 → KILLED |
printStream.printf("%s ERROR %s: %s%n", |
| 42 | new Date(), className, message); | |
| 43 | } | |
| 44 | } | |
| 45 | public void error(String message, Object... parameters) { | |
| 46 | if (this.isErrorEnabled()) { | |
| 47 | error(String.format(message, parameters)); | |
| 48 | } | |
| 49 | } | |
| 50 | /** package-private - we don't need to set this from everywhere */ | |
| 51 | void setPrintOut(PrintStream stream) { | |
| 52 |
1
1. setPrintOut : Removed assignment to member variable printStream → KILLED |
this.printStream = stream; |
| 53 | } | |
| 54 | } | |
Mutations | ||
| 10 |
1.1 |
|
| 13 |
1.1 |
|
| 16 |
1.1 2.2 |
|
| 19 |
1.1 |
|
| 30 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 9.9 10.10 11.11 12.12 13.13 14.14 15.15 16.16 17.17 18.18 19.19 20.20 21.21 22.22 23.23 24.24 25.25 26.26 27.27 28.28 |
|
| 41 |
1.1 2.2 3.3 4.4 5.5 6.6 7.7 8.8 9.9 10.10 11.11 12.12 13.13 14.14 15.15 16.16 17.17 18.18 19.19 20.20 21.21 22.22 23.23 24.24 25.25 26.26 27.27 28.28 |
|
| 52 |
1.1 |