当前位置: 首页>>代码示例>>Java>>正文


Java LogService类代码示例

本文整理汇总了Java中org.scijava.log.LogService的典型用法代码示例。如果您正苦于以下问题:Java LogService类的具体用法?Java LogService怎么用?Java LogService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LogService类属于org.scijava.log包,在下文中一共展示了LogService类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: executePythonCode

import org.scijava.log.LogService; //导入依赖的package包/类
public static Map<String, String> executePythonCode(File pythonBinaryPath, String sourceCode, LogService log) {

        Map<String, String> results = null;

        try {
            File tempFile = File.createTempFile("scijava-script", ".py");
            Files.write(tempFile.toPath(), sourceCode.getBytes());

            String[] cmd = new String[]{pythonBinaryPath.toString(), tempFile.toString()};

            results = ProcessUtil.executeProcess(cmd, log);
        } catch (IOException ex) {
            log.error(ex);
        }

        return results;
    }
 
开发者ID:scijava,项目名称:scijava-jupyter-kernel,代码行数:18,代码来源:ProcessUtil.java

示例2: testOpenHelpPageOpensDialogWhenPlatformServiceNull

import org.scijava.log.LogService; //导入依赖的package包/类
@Test
public void testOpenHelpPageOpensDialogWhenPlatformServiceNull()
	throws Exception
{
	final UIService uiService = mock(UIService.class);
	final LogService logService = mock(LogService.class);

	Help.openHelpPage("http://bone.org", null, uiService, logService);

	// verify that showDialog was called
	verify(uiService).showDialog(
		"Help page could not be opened: no platform service", ERROR_MESSAGE);

	// verify that the exception was logged
	verify(logService).error("Platform service is null");
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:17,代码来源:HelpTest.java

示例3: testOpenHelpPageOpensDialogWhenURLMalformed

import org.scijava.log.LogService; //导入依赖的package包/类
@Test
public void testOpenHelpPageOpensDialogWhenURLMalformed() throws Exception {
	final String badAddress = "htp://bone.org";
	final PlatformService platformService = mock(PlatformService.class);
	final UIService uiService = mock(UIService.class);
	final LogService logService = mock(LogService.class);

	Help.openHelpPage(badAddress, platformService, uiService, logService);

	// verify that showDialog was called
	verify(uiService).showDialog(
		"Help page could not be opened: invalid address (" + badAddress + ")",
		ERROR_MESSAGE);

	// verify that the exception was logged
	verify(logService).error(any(MalformedURLException.class));
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:18,代码来源:HelpTest.java

示例4: testOpenHelpPageOpensDialogWhenIOException

import org.scijava.log.LogService; //导入依赖的package包/类
@Test
public void testOpenHelpPageOpensDialogWhenIOException() throws Exception {
	final PlatformService platformService = mock(PlatformService.class);
	doThrow(new IOException()).when(platformService).open(any(URL.class));
	final UIService uiService = mock(UIService.class);
	final LogService logService = mock(LogService.class);

	Help.openHelpPage("http://bone.org", platformService, uiService,
		logService);

	// verify that showDialog was called
	verify(uiService).showDialog(
		"An unexpected error occurred while trying to open the help page",
		ERROR_MESSAGE);

	// verify that the exception was logged
	verify(logService).error(any(IOException.class));
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:19,代码来源:HelpTest.java

示例5: addMesh

import org.scijava.log.LogService; //导入依赖的package包/类
public graphics.scenery.Node addMesh( Mesh scMesh, LogService logService ) {
    Material material = new Material();
    material.setAmbient( new GLVector(1.0f, 0.0f, 0.0f) );
    material.setDiffuse( new GLVector(0.0f, 1.0f, 0.0f) );
    material.setSpecular( new GLVector(1.0f, 1.0f, 1.0f) );
    material.setDoubleSided(false);

    scMesh.setMaterial( material );
    scMesh.setPosition( new GLVector(1.0f, 1.0f, 1.0f) );

    activeNode = scMesh;

    getScene().addChild( scMesh );

    if( defaultArcBall ) enableArcBallControl();

    return scMesh;
}
 
开发者ID:scenerygraphics,项目名称:SciView,代码行数:19,代码来源:SciView.java

示例6: takeScreenshot

import org.scijava.log.LogService; //导入依赖的package包/类
public void takeScreenshot( LogService logService ) {

        logService.warn("Screenshot temporarily disabled");

        /*
    	float[] bounds = viewer.getRenderer().getWindow().getClearglWindow().getBounds();
    	// if we're in a jpanel, this isn't the way to get bounds
    	try {
			Robot robot = new Robot();

			BufferedImage screenshot = robot.createScreenCapture( new Rectangle( (int)bounds[0], (int)bounds[1], (int)bounds[2], (int)bounds[3] ) );

			ImagePlus imp = new ImagePlus( "SceneryViewer_Screenshot", screenshot );

			imp.show();

		} catch (AWTException e) {
			e.printStackTrace();
		}
		*/
    }
 
开发者ID:scenerygraphics,项目名称:SciView,代码行数:22,代码来源:SciView.java

示例7: main

import org.scijava.log.LogService; //导入依赖的package包/类
public static void main(String... args) {
    Context context = new Context();

    LogService log = context.service(LogService.class);
    log.setLevel(LogLevel.INFO);

    JupyterService jupyter = context.service(JupyterService.class);
    jupyter.installKernel(args);

    context.dispose();
}
 
开发者ID:scijava,项目名称:scijava-jupyter-kernel,代码行数:12,代码来源:InstallScijavaKernel.java

示例8: deleteFolderRecursively

import org.scijava.log.LogService; //导入依赖的package包/类
public static void deleteFolderRecursively(Path rootPath, LogService log) {
    if (rootPath.toFile().exists()) {
        try {
            Files.walk(rootPath, FileVisitOption.FOLLOW_LINKS)
                    .sorted(Comparator.reverseOrder())
                    .map(Path::toFile)
                    .forEach(File::delete);
        } catch (IOException ex) {
            log.error(ex);
        }
    }
}
 
开发者ID:scijava,项目名称:scijava-jupyter-kernel,代码行数:13,代码来源:SystemUtil.java

示例9: openHelpPage

import org.scijava.log.LogService; //导入依赖的package包/类
/**
 * Opens the given help page using the PlatformService
 *
 * @see PlatformService#open(URL)
 * @param url The address of the help page
 * @param platformService PlatformService of the context
 * @param uiService UIService to show potential error messages
 * @param logService LogService to log potential exceptions, e.g.
 *          MalformedURLException
 */
public static void openHelpPage(final String url,
	final PlatformService platformService,
	final UIService uiService,
	final LogService logService)
{
	if (platformService == null) {
		showErrorSafely(uiService,
			"Help page could not be opened: no platform service");
		if (logService != null) {
			logService.error("Platform service is null");
		}
		return;
	}

	try {
		URL helpUrl = new URL(url);
		platformService.open(helpUrl);
	}
	catch (final MalformedURLException mue) {
		showErrorSafely(uiService,
			"Help page could not be opened: invalid address (" + url + ")");
		if (logService != null) {
			logService.error(mue);
		}
	}
	catch (final IOException e) {
		showErrorSafely(uiService,
			"An unexpected error occurred while trying to open the help page");
		if (logService != null) {
			logService.error(e);
		}
	}
}
 
开发者ID:bonej-org,项目名称:BoneJ2,代码行数:44,代码来源:Help.java

示例10: displayNodeProperties

import org.scijava.log.LogService; //导入依赖的package包/类
public void displayNodeProperties( Node n, LogService logService ) {
    logService.warn( "Position: " + n.getPosition() +
            " bounding box: [ " + n.getBoundingBoxCoords()[0] + ", " +
            n.getBoundingBoxCoords()[1] + ", " +
            n.getBoundingBoxCoords()[2] + ", " +
            n.getBoundingBoxCoords()[3] + ", " +
            n.getBoundingBoxCoords()[4] + ", " +
            n.getBoundingBoxCoords()[5] + " ]" );
}
 
开发者ID:scenerygraphics,项目名称:SciView,代码行数:10,代码来源:SciView.java

示例11: errorIfNetworkInaccessible

import org.scijava.log.LogService; //导入依赖的package包/类
/**
 * If there is no network connection, then produce an error and return true.
 * Otherwise return false.
 */
public static boolean errorIfNetworkInaccessible(final LogService log) {
	try {
		testNetworkConnection();
	}
	catch (final SecurityException | IOException exc) {
		final String msg = exc.getMessage();
		String friendlyError = "Cannot connect to the Internet.";
		if (msg != null && msg.indexOf(
			"Address family not supported by protocol family: connect") >= 0)
		{
			friendlyError += "" + //
				"\n-----------------------------------------------------------" + //
				"\n* Check your computer for spyware called RelevantKnowledge" + //
				"\n* Try disabling your antivirus software temporarily" + //
				"\n* Try disabling IPv6 temporarily" + //
				"\n* See also http://forum.imagej.net/t/5070" + //
				"\n-----------------------------------------------------------";
		}
		friendlyError += "" + //
			"\nDo you have a network connection?" + //
			"\nAre your proxy settings correct?";
		UpdaterUserInterface.get().error(friendlyError);
		if (log != null) log.error(exc);
		return true;
	}
	return false;
}
 
开发者ID:imagej,项目名称:imagej-ui-swing,代码行数:32,代码来源:ImageJUpdater.java

示例12: RefCleaner

import org.scijava.log.LogService; //导入依赖的package包/类
public RefCleaner(final ReferenceQueue queue, final Set<Reference> refs,
	final LogService log, final boolean[] runFlag)
{
	this.queue = queue;
	this.refs = refs;
	logService = log;
	run = runFlag;
}
 
开发者ID:scifio,项目名称:scifio,代码行数:9,代码来源:DefaultRefManagerService.java

示例13: print

import org.scijava.log.LogService; //导入依赖的package包/类
/** Debugging method; prints information on an atom. */
private static void print(final int depth, final long size,
	final String type, final LogService log)
{
	final StringBuilder sb = new StringBuilder();
	for (int i = 0; i < depth; i++)
		sb.append(" ");
	sb.append(type + " : [" + size + "]");
	log.debug(sb.toString());
}
 
开发者ID:scifio,项目名称:scifio,代码行数:11,代码来源:NativeQTFormat.java

示例14: executeProcess

import org.scijava.log.LogService; //导入依赖的package包/类
public static Map<String, String> executeProcess(String[] cmd, LogService log) {

        Map<String, String> results = new HashMap<>();

        try {

            Process proc = Runtime.getRuntime().exec(cmd);
            proc.waitFor();

            BufferedReader outputStream = new BufferedReader(new InputStreamReader(proc.getInputStream()));
            String output = outputStream.lines().collect(Collectors.joining("\n"));

            BufferedReader errorStream = new BufferedReader(new InputStreamReader(proc.getErrorStream()));
            String error = errorStream.lines().collect(Collectors.joining("\n"));

            results.put("output", output);
            results.put("error", error);

        } catch (IOException | InterruptedException ex) {
            log.error(ex);
        }

        return results;
    }
 
开发者ID:scijava,项目名称:scijava-jupyter-kernel,代码行数:25,代码来源:ProcessUtil.java

示例15: addSTL

import org.scijava.log.LogService; //导入依赖的package包/类
public graphics.scenery.Node addSTL( String filename, LogService logService ) {

        Mesh scMesh = new Mesh();
        scMesh.readFromSTL( filename );

        //scMesh.generateBoundingBox();

        //net.imagej.ops.geom.geom3d.mesh.Mesh opsMesh = MeshConverter.getOpsMesh( scMesh );

        //((DefaultMesh) opsMesh).centerMesh();

        //addMesh( opsMesh );

        addMesh( scMesh, logService );
        return scMesh;
    }
 
开发者ID:scenerygraphics,项目名称:SciView,代码行数:17,代码来源:SciView.java


注:本文中的org.scijava.log.LogService类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。