Created
June 4, 2011 02:58
-
-
Save behrangsa/1007513 to your computer and use it in GitHub Desktop.
Logger
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Logger { | |
private Level level = Level.WARNING; | |
public void setLevel(Level level) { | |
this.level = level; | |
} | |
public void log(Level level, { => String} message) { | |
if (this.level == level) { | |
String loggableMessage = message.invoke(); | |
log(loggableMessage); | |
} | |
} | |
public void log(String message) { | |
System.out.println(message); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment