本文整理汇总了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");
}
示例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;
}
}
示例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);
}
}
示例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();
}
}
示例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)));
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
}
示例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();
}
}
示例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");
}
}
示例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");
}
示例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>");
}
示例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();
}
示例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;
}
示例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);
}
}