Mercurial > hg > graal-jvmci-8
comparison graal/com.oracle.graal.debug/src/com/oracle/graal/debug/internal/DebugScope.java @ 18875:d71bf1009d71
Fix indentation of multi-line strings passed to Debug.log
author | Paul Woegerer <paul.woegerer@oracle.com> |
---|---|
date | Fri, 16 Jan 2015 14:24:04 +0100 |
parents | 41d12b67bc9e |
children | 06536c3846e7 |
comparison
equal
deleted
inserted
replaced
18874:e847e842ce93 | 18875:d71bf1009d71 |
---|---|
55 public void log(int logLevel, String msg, Object... args) { | 55 public void log(int logLevel, String msg, Object... args) { |
56 if (isLogEnabled(logLevel)) { | 56 if (isLogEnabled(logLevel)) { |
57 StringBuilder str = new StringBuilder(); | 57 StringBuilder str = new StringBuilder(); |
58 printScopeName(str); | 58 printScopeName(str); |
59 str.append(indent); | 59 str.append(indent); |
60 if (args.length == 0) { | 60 String result = args.length == 0 ? msg : String.format(msg, args); |
61 str.append(msg); | 61 String lineSep = System.lineSeparator(); |
62 } else { | 62 str.append(result.replace(lineSep, lineSep.concat(indent))); |
63 str.append(String.format(msg, args)); | 63 str.append(lineSep); |
64 } | |
65 str.append(System.lineSeparator()); | |
66 output.append(str); | 64 output.append(str); |
67 lastUsedIndent = this; | 65 lastUsedIndent = this; |
68 } | 66 } |
69 } | 67 } |
70 | 68 |