MCPcopy Index your code
hub / github.com/apache/groovy / log

Method log

src/main/java/org/codehaus/groovy/tools/shell/util/Logger.java:47–78  ·  view source on GitHub ↗
(final String level, Object msg, Throwable cause)

Source from the content-addressed store, hash-verified

45 }
46
47 private void log(final String level, Object msg, Throwable cause) {
48 assert level != null;
49 assert msg != null;
50
51 if (io == null) {
52 synchronized (Logger.class) {
53 if (io == null) {
54 io = new IO();
55 }
56 }
57 }
58
59 // Allow the msg to be a Throwable, and handle it properly if no cause is given
60 if (cause == null) {
61 if (msg instanceof Throwable) {
62 cause = (Throwable) msg;
63 msg = cause.getMessage();
64 }
65 }
66
67 if (io.ansiSupported) {
68 logWithAnsi(level, msg);
69 } else {
70 logDefault(level, msg);
71 }
72
73 if (cause != null) {
74 cause.printStackTrace(io.out);
75 }
76
77 io.flush();
78 }
79
80 private void logDefault(String level, Object msg) {
81 io.out.println(level + " [" + name + "] " + msg);

Callers 11

debugMethod · 0.95
warnMethod · 0.95
errorMethod · 0.95
checkFilesMethod · 0.45
doCompilationMethod · 0.45
mainMethod · 0.45
rootLoaderMethod · 0.45
exitMethod · 0.45
compileMethod · 0.45

Calls 5

logWithAnsiMethod · 0.95
logDefaultMethod · 0.95
printStackTraceMethod · 0.80
getMessageMethod · 0.45
flushMethod · 0.45

Tested by

no test coverage detected