com.github.jy2.commandline.picocli.log.LogEchoCommand Maven / Gradle / Ivy
package com.github.jy2.commandline.picocli.log;
import java.text.SimpleDateFormat;
import java.util.function.Consumer;
import com.github.jy2.commandline.picocli.Main;
import com.github.jy2.commandline.picocli.topic.TopicEchoCommand;
import com.github.jy2.logs.console.utils.LogLevel;
import com.github.jy2.logs.console.utils.LogLevelUtils;
import go.jyroscope.ros.rosgraph_msgs.Log;
import picocli.CommandLine.Command;
import picocli.CommandLine.Option;
import picocli.CommandLine.ParentCommand;
@Command(name = "echo", description = "Print list of topics")
public class LogEchoCommand implements Runnable {
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");;
@ParentCommand
LogCommand parent;
@Option(names = { "--level" }, description = "Logging level")
LogLevel level;
@Option(names = { "--node" }, description = "Node name")
String node;
@Option(names = { "--class" }, description = "Class name")
String file;
@Option(names = { "--method" }, description = "Method name")
String function;
@Option(names = { "--line" }, description = "Line number")
int line = -1;
@Option(names = { "--grep" }, description = "Character sequence to be expected in serialized message content")
String grep;
@Option(names = { "--fullMessage" }, description = "Display full message")
boolean fullMessage = false;
public void run() {
System.out.println("Subscribed to topic: /rosout");
System.out.println("Press Crtl-C to stop");
TopicEchoCommand.subscriber = Main.di.createSubscriber("/rosout", null);
TopicEchoCommand.subscriber.addMessageListener(new Consumer
© 2015 - 2024 Weber Informatics LLC | Privacy Policy