Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[test] beautify logfile output #585

Merged
merged 1 commit into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ public AbstractDebugTest(String name) {

@Override
protected void setUp() throws Exception {
TestUtil.log(IStatus.INFO, getName(), "setUp");
TestUtil.logInfo("SETUP " + getClass().getSimpleName() + "." + getName());
super.setUp();
setPreferences();
IProject pro = ResourcesPlugin.getWorkspace().getRoot().getProject(ONE_FOUR_PROJECT_NAME);
Expand Down Expand Up @@ -2790,7 +2790,7 @@ public void runBare() throws Throwable {

@Override
protected void tearDown() throws Exception {
TestUtil.log(IStatus.INFO, getName(), "tearDown");
TestUtil.logInfo("TDOWN " + getClass().getSimpleName() + "." + getName());
shutdownDebugTargets();
TestUtil.cleanUp(getName());
super.tearDown();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@

import java.lang.management.ManagementFactory;
import java.lang.management.ThreadInfo;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Date;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
Expand Down Expand Up @@ -65,6 +67,10 @@ public static void cleanUp(String owner) {
Assert.assertEquals("expected no launches after test", Collections.EMPTY_LIST, launches);
}

public static void logInfo(String message) {
System.out.println(new SimpleDateFormat("HH:mm:ss.SSS").format(new Date()) + " " + message);
}

public static void log(int severity, String owner, String message, Throwable... optionalError) {
message = "[" + owner + "] " + message;
Throwable error = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaProject;
Expand Down Expand Up @@ -120,13 +119,13 @@ private static IJavaProject createProject(String name) throws CoreException {

@Before
public void setUp() throws Exception {
TestUtil.log(IStatus.INFO, name.getMethodName(), "setUp");
TestUtil.logInfo("SETUP " + getClass().getSimpleName() + "." + name.getMethodName());
fSourceFolder = JavaProjectHelper.addSourceContainer(fJProject, "src");
}

@After
public void tearDown() throws Exception {
TestUtil.log(IStatus.INFO, name.getMethodName(), "tearDown");
TestUtil.logInfo("TDOWN " + getClass().getSimpleName() + "." + name.getMethodName());
JavaProjectHelper.removeSourceContainer(fJProject, "src");
}

Expand Down
Loading