This repository was archived by the owner on Jun 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree
main/java/com/caseyjbrooks/clog
orchid/resources/changelog Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -98,6 +98,10 @@ public static ClogProfile tag(String tag) {
9898 return getInstance ().tag (tag );
9999 }
100100
101+ public static ClogProfile noTag () {
102+ return getInstance ().tag (null );
103+ }
104+
101105// Generic key-valued logging calls
102106//--------------------------------------------------------------------------------------------------
103107
Original file line number Diff line number Diff line change @@ -36,13 +36,13 @@ public boolean isActive() {
3636
3737 @ Override
3838 public int log (String tag , String message ) {
39- AnsiConsole .out .println (getAnsiLevelString ().a (tag + ": " ).a (message ));
39+ AnsiConsole .out .println (getAnsiLevelString ().a (getTagString ( tag ) ).a (message ));
4040 return 0 ;
4141 }
4242
4343 @ Override
4444 public int log (String tag , String message , Throwable throwable ) {
45- AnsiConsole .out .println (getAnsiLevelString ().a (tag + ": " ) .a (message ).a (" (" + throwable . getMessage () + ")" ));
45+ AnsiConsole .out .println (getAnsiLevelString ().a (getTagString ( tag )) .a (message ).a (getThrowableString ( throwable ) ));
4646 return 0 ;
4747 }
4848
@@ -74,4 +74,17 @@ Ansi getAnsiLevelString() {
7474
7575 return Ansi .ansi ();
7676 }
77+
78+ private String getTagString (String tag ) {
79+ if (tag != null && tag .length () > 0 ) {
80+ return tag + ": " ;
81+ }
82+ else {
83+ return "" ;
84+ }
85+ }
86+
87+ private String getThrowableString (Throwable throwable ) {
88+ return " (" + throwable .getMessage () + ")" ;
89+ }
7790}
Original file line number Diff line number Diff line change 1+ ---
2+ version : ' 2.0.4'
3+ ---
4+
5+ - Don't print empty tags in DefaultLogger messages
You can’t perform that action at this time.
0 commit comments