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


Java Logger.info方法代码示例

本文整理汇总了Java中org.pmw.tinylog.Logger.info方法的典型用法代码示例。如果您正苦于以下问题:Java Logger.info方法的具体用法?Java Logger.info怎么用?Java Logger.info使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.pmw.tinylog.Logger的用法示例。


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

示例1: main

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
public static void main(String[] args) {

		// source coude generate level tag
		final String preLevelTag = "[[preLevelTag]]";
		final String postLevelTag = "[[postLevelTag]]";

		// for "1 default example" and "2 log-level decoration example" (see tinylog.properties) 
		Logger.trace("hello trace-world");
		Logger.debug("hello debug-world");
		Logger.info("hello info-world");
		Logger.warn("hello warn-world");
		//		Logger.warn("hello warn-world with {}source code generated{} 'misuse' of the level tag", preLevelTag, postLevelTag);
		Logger.error("hello error-world");


		// for "3 custom tag usage example" (see tinylog.properties)
		//		Logger.info("Example 1 - sequential tag replacement:   [[someCustomPreTag]] some text [[someCustomPostTag]] and possibly some other text");
		//		Logger.info("Example 2 - coloring of tag occurrence:   ----- pre-init (phase 1) ----- and possibly some other text");
		//		Logger.info("Example 3 - coloring within a tag:        <---- init (phase 2) ----> and possibly some other text");
		//		Logger.info("Example 4 - coloring of tagged content:   <==== init DONE ====> and possibly some other text");
		//		Logger.info("Example 5 - coloring or arbitrary strings: UNCAUGHT EXCEPTION: error in some class");
	}
 
开发者ID:tobiasrm,项目名称:tinylog-coloredconsole,代码行数:23,代码来源:Main.java

示例2: getArgs

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
private static String[] getArgs(final String[] cmdArgs) {
    final File argsFile = new File(ARGS_FILE_NAME);
    if (argsFile.canRead()) {
        try {
            final Scanner scanner = new Scanner(argsFile);
            final ArrayList<String> argsList = new ArrayList<>();
            while (scanner.hasNext()) {
                argsList.add(scanner.next());
            }
            scanner.close();
            Logger.info("Arguments loaded from file \"{}\"", ARGS_FILE_NAME);
            return argsList.toArray(new String[0]);
        } catch (final FileNotFoundException e) {
            Logger.warn(e, "Unable to load file \"{}\", using commandline arguments", ARGS_FILE_NAME);
            return cmdArgs;
        }
    } else {
        Logger.info("Using commandline arguments");
        return cmdArgs;
    }
}
 
开发者ID:dragonite-network,项目名称:dragonite-java,代码行数:22,代码来源:CLIMain.java

示例3: MotionTest

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
@SuppressWarnings("resource")
private MotionTest(int... pins) {
	sensors = new ArrayList<>();
	
	for (int pin : pins) {
		//DigitalInputDevice sensor = new MotionSensor(pin);
		DigitalInputDevice sensor;
		if (pin == 26) {
			// Fudge for this strange type of PIR:
			// http://skpang.co.uk/catalog/pir-motion-sensor-p-796.html
			// Red (5V) / White (Ground) / Black (open collector Alarm)
			// The alarm pin is an open collector meaning you will need a pull up resistor on the alarm pin
			// Signal motion if there are 5 or more alarms in a 200ms period, check every 50ms
			sensor = new MotionSensor(pin, GpioPullUpDown.PULL_UP, 5, 200, 50);
		} else {
			sensor = new DigitalInputDevice(pin, GpioPullUpDown.PULL_DOWN, GpioEventTrigger.BOTH);
		}
		Logger.info("Created sensor on pin " + pin + " pud=" + sensor.getPullUpDown() + ", trigger=" + sensor.getTrigger());
		sensor.whenActivated(() ->System.out.println("Pin " + pin + " activated"));
		sensor.whenDeactivated(() ->System.out.println("Pin " + pin + " deactivated"));
		sensors.add(sensor);
	}
}
 
开发者ID:mattjlewis,项目名称:diozero,代码行数:24,代码来源:MotionTest.java

示例4: test

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
private static void test(int adcNum1, int adcNum2, int pwm1, int pwm2) {
	try (PCF8591 adc = new PCF8591(1);
			AnalogInputDevice axis_1 = new AnalogInputDevice(adc, adcNum1);
			AnalogInputDevice axis_2 = new AnalogInputDevice(adc, adcNum2);
			PwmLed led1 = new PwmLed(pwm1);
			PwmLed led2 = new PwmLed(pwm2)) {
		axis_1.addListener(event -> led1.setValue(event.getUnscaledValue()));
		axis_2.addListener(event -> led2.setValue(event.getUnscaledValue()));
		for (int i=0; i<20; i++) {
			Logger.info("axis 1: {}, axis 2: {}", Float.valueOf(axis_1.getScaledValue()), Float.valueOf(axis_2.getScaledValue()));
			
			SleepUtil.sleepSeconds(1);
		}
	} finally {
		// Required if there are non-daemon threads that will prevent the
		// built-in clean-up routines from running
		DeviceFactoryHelper.getNativeDeviceFactory().close();
	}
}
 
开发者ID:mattjlewis,项目名称:diozero,代码行数:20,代码来源:JoystickTest.java

示例5: test

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
@Test
public void test() {
	double secs = 0.005123;
	
	long millis = Math.round(secs * SleepUtil.MS_IN_SEC);
	long nanos = Math.round(secs * SleepUtil.NS_IN_SEC % SleepUtil.NS_IN_MS);
	
	Logger.info(String.format("Seconds = %.9f, millis = %d, nanos = %d",
			Double.valueOf(secs), Long.valueOf(millis), Long.valueOf(nanos)));
	
	secs = 0.099789;
	
	millis = Math.round(secs * SleepUtil.MS_IN_SEC);
	nanos = Math.round(secs * SleepUtil.NS_IN_SEC % SleepUtil.NS_IN_MS);
	
	Logger.info(String.format("Seconds = %.9f, millis = %d, nanos = %d",
			Double.valueOf(secs), Long.valueOf(millis), Long.valueOf(nanos)));
	
	secs = 99.099789;
	
	millis = Math.round(secs * SleepUtil.MS_IN_SEC);
	nanos = Math.round(secs * SleepUtil.NS_IN_SEC % SleepUtil.NS_IN_MS);
	
	Logger.info(String.format("Seconds = %.9f, millis = %d, nanos = %d",
			Double.valueOf(secs), Long.valueOf(millis), Long.valueOf(nanos)));
}
 
开发者ID:mattjlewis,项目名称:diozero,代码行数:27,代码来源:MilliNanoTest.java

示例6: test

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
public static void test(int pin, int iterations) {
	try (DigitalOutputDevice gpio = new DigitalOutputDevice(pin)) {
		for (int j=0; j<5; j++) {
			long start_nano = System.nanoTime();
			for (int i=0; i<iterations; i++) {
				gpio.setValueUnsafe(true);
				gpio.setValueUnsafe(false);
			}
			long duration_ns = System.nanoTime() - start_nano;
			
			Logger.info("Duration for {} iterations: {}s", Integer.valueOf(iterations),
					String.format("%.4f", Float.valueOf(((float)duration_ns) / 1000 / 1000 / 1000)));
		}
	} catch (RuntimeIOException e) {
		Logger.error(e, "Error: {}", e);
	}
}
 
开发者ID:mattjlewis,项目名称:diozero,代码行数:18,代码来源:GpioPerfTest.java

示例7: animate

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
private static void animate(Collection<OutputDeviceInterface> targets, int fps, EasingFunction easing, float speed,
		String... files) throws IOException {
	Animation anim = new Animation(targets, fps, easing, speed);

	Gson gson = new Gson();
	for (String file : files) {
		try (Reader reader = new InputStreamReader(GsonAnimationTest.class.getResourceAsStream(file))) {
			AnimationInstance anim_obj = gson.fromJson(reader, AnimationInstance.class);

			anim.enqueue(anim_obj);
		}
	}
	
	Logger.info("Starting animation...");
	Future<?> future = anim.play();
	try {
		Logger.info("Waiting");
		future.get();
		Logger.info("Finished");
	} catch (CancellationException | ExecutionException | InterruptedException e) {
		Logger.info("Finished {}", e);
	}
}
 
开发者ID:mattjlewis,项目名称:diozero,代码行数:24,代码来源:GsonAnimationTest.java

示例8: waitForCard

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
private static void waitForCard(int controller, int chipSelect, int resetPin) {
		try (MFRC522 mfrc522 = new MFRC522(controller, chipSelect, resetPin)) {
//			if (mfrc522.performSelfTest()) {
//				Logger.debug("Self test passed");
//			} else {
//				Logger.debug("Self test failed");
//			}
			// Wait for a card
			MFRC522.UID uid = null;
			while (uid == null) {
				Logger.info("Waiting for a card");
				uid = getID(mfrc522);
				Logger.debug("uid: {}", uid);
				SleepUtil.sleepSeconds(1);
			}
		}
	}
 
开发者ID:mattjlewis,项目名称:diozero,代码行数:18,代码来源:MFRC522Test.java

示例9: evaluatePerformance

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
private void evaluatePerformance(String type, String goldfile, String maxSentenceSize) {
    try {
        int maxSenSize = maxSentenceSize.equals("all") ? 1000000 : Integer.parseInt(maxSentenceSize);
        int[][] predictions = getParses(goldfile, maxSenSize);
        double[] accuracy = DepEvaluator.evaluate(goldfile, predictions, maxSenSize);
        Logger.info("Acc of " + type + "-" + maxSentenceSize + ": " + goldfile);
        Logger.info("Unlabeled Accuracy: " + accuracy[0]);
        Logger.info("Unlabeled Complete Correct: " + accuracy[1] + "\n");
    } catch (IOException e) {
        e.printStackTrace();
    }
}
 
开发者ID:shtechair,项目名称:CRFAE-Dep-Parser,代码行数:13,代码来源:DepParserLauncher.java

示例10: train

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
public void train(DepInstance[] il) {
    System.out.println("========================");
    System.out.println("About to train.");
    System.out.println("Training set size: " + il.length);
    System.out.println();

    params.kmInit(il);

    boolean trainingDone = false;
    for (int i = 0; !trainingDone; i++) {
        System.out.println("========================");
        System.out.println("Iteration: " + i);
        System.out.println("========================");
        System.out.print("Processed: \n");

        Logger.info("Iteration: " + i);

        long start = System.currentTimeMillis();
        /// Training
        UnsupervisedTrainer trainer = new UnsupervisedTrainer(il, pipe, params);

        double objectiveBefore = trainer.objectiveFunction.valueAt(il, params);
        params = trainer.iteration();
        double objectiveAfter = trainer.objectiveFunction.valueAt(il, params);
        System.out.format("Objective: %f -> %f\n", objectiveBefore, objectiveAfter);
        Logger.info("Objective: {} -> {}", objectiveBefore, objectiveAfter);

        trainingDone = ((objectiveBefore - objectiveAfter) / objectiveBefore) < THRESHOLD;

        long end = System.currentTimeMillis();
        System.out.println("Training iteration took: " + (end - start) + " ms");
        Logger.info("Training iteration took: " + (end - start) + " ms \n");

    }
}
 
开发者ID:shtechair,项目名称:CRFAE-Dep-Parser,代码行数:36,代码来源:DepParserLauncher.java

示例11: Application

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
private Application() throws Exception {
    Logger.info("Start");

    final RatpackServer server = RatpackServer.of(s -> s
            .handlers(chain -> chain
                    .post("graphql", new GraphQLHandler())));
    server.start();

    Logger.info("Finish");
}
 
开发者ID:nwillc,项目名称:ratpack-graphql,代码行数:11,代码来源:Application.java

示例12: doGet

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {

    resp.setContentType("text/html");
    PrintWriter out = resp.getWriter();

    Logger.info("HelloController");
    try {
        BeanFactory factory = new ClassPathXmlApplicationContext();
        UserService userService = (UserService) factory.getBean("userService");
        List<User> users = userService.GetUsers();
        String usersJson = JSON.toJSONString(users);
        out.println(usersJson);
    } catch (Exception e) {
        // Handle it.
        out.println("<h3>Exception</h3>");
        out.println("<h3>" + e.getMessage() + "</h3>");

        e.printStackTrace();
        out.println("------------------------------");
        for (StackTraceElement elem : e.getStackTrace()) {
            out.println("<br>");
            out.println(elem);
        }
    }

    out.println("<h3>" + message + "</h3>");
}
 
开发者ID:xujiajun,项目名称:tastjava,代码行数:29,代码来源:HelloController.java

示例13: sayTestContext

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
@GET
@Path("/context/{id}")
public String sayTestContext(@Context UriInfo ui,@PathParam("id") int id) {
    Logger.info(ui.getPathParameters());
    return ui.getPath();
}
 
开发者ID:xujiajun,项目名称:tastjava,代码行数:7,代码来源:HelloResource.java

示例14: isAuthTokenValid

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
private boolean isAuthTokenValid(ContainerRequestContext containerRequestContext) {
    Map<String, Cookie> cookies = containerRequestContext.getCookies();

    if (cookies.get("jwt-authToken") != null) {
        String authToken = cookies.get("jwt-authToken").getValue();
        Logger.info(authToken);
        Integer uid = JWTProvider.verifyToken(authToken).getClaim("uid").asInt();
        Logger.info(uid);
        return true;
    }
    return false;
}
 
开发者ID:xujiajun,项目名称:tastjava,代码行数:13,代码来源:ResourceAuthFilter.java

示例15: checkUpdate

import org.pmw.tinylog.Logger; //导入方法依赖的package包/类
private static void checkUpdate() {
    final UpdateChecker updateChecker = new UpdateChecker(ProxyGlobalConstants.UPDATE_API_URL);

    Logger.info("Checking for updates...");

    final String remoteVersion = updateChecker.getVersionString(ProxyGlobalConstants.UPDATE_API_PRODUCT_NAME);
    if (remoteVersion != null && remoteVersion.equals(ProxyGlobalConstants.APP_VERSION)) {
        Logger.info("You are already using the latest version.");
    } else if (remoteVersion != null && remoteVersion.length() > 0) {
        Logger.info("** New version available! v{} **", remoteVersion);
    }
}
 
开发者ID:dragonite-network,项目名称:dragonite-java,代码行数:13,代码来源:CLIMain.java


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