Skip to content

Commit e7fc2c9

Browse files
committed
Highlight important log messages
1 parent c91520a commit e7fc2c9

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

src/main/java/com/iexec/worker/Application.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.iexec.worker.config.WorkerConfigurationService;
1010
import com.iexec.worker.feign.CustomFeignClient;
1111
import com.iexec.worker.result.ResultService;
12+
import com.iexec.worker.utils.LoggingUtils;
1213
import com.iexec.worker.utils.version.VersionService;
1314
import lombok.extern.slf4j.Slf4j;
1415
import org.springframework.beans.factory.annotation.Autowired;
@@ -87,8 +88,11 @@ public void run(String... args) {
8788

8889
if (!publicConfiguration.getRequiredWorkerVersion().isEmpty() &&
8990
!versionService.getVersion().equals(publicConfiguration.getRequiredWorkerVersion())) {
90-
log.error("Bad version, please upgrade your iexec-worker [current:{}, required:{}]",
91+
92+
String message = String.format("Bad version! please upgrade your iexec-worker [current:%s, required:%s]",
9193
versionService.getVersion(), publicConfiguration.getRequiredWorkerVersion());
94+
95+
LoggingUtils.printHighlightedMessage(message);
9296
System.exit(0);
9397
}
9498

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package com.iexec.worker.utils;
2+
3+
import java.util.Collections;
4+
5+
public class LoggingUtils {
6+
7+
8+
public static void printHighlightedMessage(String message) {
9+
String hashtagSequence = String.join("", Collections.nCopies(message.length() + 2, "#"));
10+
String spaceSequence = String.join("", Collections.nCopies(message.length(), " "));
11+
12+
System.out.println();
13+
System.out.println("#" + hashtagSequence + "#");
14+
System.out.println("# " + spaceSequence + " #");
15+
System.out.println("# " + message + " #");
16+
System.out.println("# " + spaceSequence + " #");
17+
System.out.println("#" + hashtagSequence + "#");
18+
System.out.println();
19+
}
20+
}

0 commit comments

Comments
 (0)