-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[feature] upgrade gradle version && chang dsl to extension.
- Loading branch information
wangshichang
committed
Jul 5, 2021
1 parent
8c249f5
commit 15c0fda
Showing
15 changed files
with
273 additions
and
96 deletions.
There are no files selected for viewing
File renamed without changes.
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,16 @@ | ||
apply plugin: 'groovy' | ||
|
||
dependencies { | ||
compile gradleApi() | ||
compile localGroovy() | ||
compile fileTree(dir: 'libs', include: ['*.jar']) | ||
} | ||
|
||
buildscript { | ||
repositories { | ||
jcenter() | ||
} | ||
dependencies { | ||
|
||
} | ||
} |
File renamed without changes.
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,118 @@ | ||
package pea.pod; | ||
|
||
import java.io.PrintWriter; | ||
import java.io.StringWriter; | ||
|
||
public class Log { | ||
|
||
private static LogImp debugLog = new LogImp() { | ||
|
||
@Override | ||
public void v(final String tag, final String msg, final Object... obj) { | ||
String log = obj == null ? msg : String.format(msg, obj); | ||
System.out.println(String.format("[VERBOSE][%s]%s", tag, log)); | ||
} | ||
|
||
@Override | ||
public void i(final String tag, final String msg, final Object... obj) { | ||
String log = obj == null ? msg : String.format(msg, obj); | ||
System.out.println(String.format("[INFO][%s]%s", tag, log)); | ||
} | ||
|
||
@Override | ||
public void d(final String tag, final String msg, final Object... obj) { | ||
String log = obj == null ? msg : String.format(msg, obj); | ||
System.out.println(String.format("[DEBUG][%s]%s", tag, log)); | ||
} | ||
|
||
@Override | ||
public void w(final String tag, final String msg, final Object... obj) { | ||
String log = obj == null ? msg : String.format(msg, obj); | ||
System.out.println(String.format("[WARN][%s]%s", tag, log)); | ||
} | ||
|
||
@Override | ||
public void e(final String tag, final String msg, final Object... obj) { | ||
String log = obj == null ? msg : String.format(msg, obj); | ||
System.out.println(String.format("[ERROR][%s]%s", tag, log)); | ||
} | ||
|
||
@Override | ||
public void printErrStackTrace(String tag, Throwable tr, String format, Object... obj) { | ||
String log = obj == null ? format : String.format(format, obj); | ||
if (log == null) { | ||
log = ""; | ||
} | ||
StringWriter sw = new StringWriter(); | ||
PrintWriter pw = new PrintWriter(sw); | ||
tr.printStackTrace(pw); | ||
log += " " + sw.toString(); | ||
System.out.println(String.format("[ERROR][%s]%s", tag, log)); | ||
} | ||
}; | ||
|
||
private static LogImp logImp = debugLog; | ||
|
||
private Log() { | ||
} | ||
|
||
public static void setLogImp(LogImp imp) { | ||
logImp = imp; | ||
} | ||
|
||
public static LogImp getImpl() { | ||
return logImp; | ||
} | ||
|
||
public static void v(final String tag, final String msg, final Object... obj) { | ||
if (logImp != null) { | ||
logImp.v(tag, msg, obj); | ||
} | ||
} | ||
|
||
public static void e(final String tag, final String msg, final Object... obj) { | ||
if (logImp != null) { | ||
logImp.e(tag, msg, obj); | ||
} | ||
} | ||
|
||
public static void w(final String tag, final String msg, final Object... obj) { | ||
if (logImp != null) { | ||
logImp.w(tag, msg, obj); | ||
} | ||
} | ||
|
||
public static void i(final String tag, final String msg, final Object... obj) { | ||
if (logImp != null) { | ||
logImp.i(tag, msg, obj); | ||
} | ||
} | ||
|
||
public static void d(final String tag, final String msg, final Object... obj) { | ||
if (logImp != null) { | ||
logImp.d(tag, msg, obj); | ||
} | ||
} | ||
|
||
public static void printErrStackTrace(String tag, Throwable tr, final String format, final Object... obj) { | ||
if (logImp != null) { | ||
logImp.printErrStackTrace(tag, tr, format, obj); | ||
} | ||
} | ||
|
||
public interface LogImp { | ||
|
||
void v(final String tag, final String msg, final Object... obj); | ||
|
||
void i(final String tag, final String msg, final Object... obj); | ||
|
||
void w(final String tag, final String msg, final Object... obj); | ||
|
||
void d(final String tag, final String msg, final Object... obj); | ||
|
||
void e(final String tag, final String msg, final Object... obj); | ||
|
||
void printErrStackTrace(String tag, Throwable tr, final String format, final Object... obj); | ||
|
||
} | ||
} |
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
Oops, something went wrong.