-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add optional color to labels, fix extra newline on debug
- Loading branch information
1 parent
3ed2bca
commit fe111b7
Showing
6 changed files
with
111 additions
and
27 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package temalab.logger; | ||
|
||
public class Label { | ||
public enum Color { | ||
Black(30, 40), | ||
Red(31, 41), | ||
Green(32, 42), | ||
Yellow(33, 43), | ||
Blue(34, 44), | ||
Magenta(35, 45), | ||
Cyan(36, 46), | ||
White(37, 47), | ||
Default(39, 49), | ||
None(0, 0); | ||
|
||
final String foreground; | ||
final String background; | ||
|
||
Color(int foreground, int background) { | ||
this.foreground = "\u001B[" + foreground + "m"; | ||
this.background = "\u001B[" + background + "m"; | ||
} | ||
} | ||
|
||
public final String label; | ||
public final String color; | ||
|
||
public Label(String label, Label.Color foregroundColor, Label.Color backgroundColor) { | ||
this.label = label; | ||
this.color = | ||
(foregroundColor.equals(Label.Color.None) ? "" : foregroundColor.foreground) | ||
+ (backgroundColor.equals(Label.Color.None) ? "" : backgroundColor.background); | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
package temalab.logger; | ||
|
||
public interface Logger { | ||
public void debug(String label, String message); | ||
public void debug(Label label, String message); | ||
|
||
public void info(String label, String message); | ||
public void info(Label label, String message); | ||
|
||
public void warning(String label, String message); | ||
public void warning(Label label, String message); | ||
|
||
public void error(String label, String message); | ||
public void error(Label label, String message); | ||
} |
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