org.jpos.util.Logger.removeListener()方法的使用及代码示例

x33g5p2x  于2022-01-24 转载在 其他  
字(1.3k)|赞(0)|评价(0)|浏览(216)

本文整理了Java中org.jpos.util.Logger.removeListener()方法的一些代码示例,展示了Logger.removeListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Logger.removeListener()方法的具体详情如下:
包路径:org.jpos.util.Logger
类名称:Logger
方法名:removeListener

Logger.removeListener介绍

暂无

代码示例

代码示例来源:origin: jpos/jPOS

@Test
public void testRemoveListener() throws Throwable {
  Logger logger = new Logger();
  logger.removeListener(new SimpleLogListener());
  assertEquals("m_logger.listeners.size()", 0, logger.listeners.size());
}

代码示例来源:origin: jpos/jPOS

public void exec(CLIContext cli, String[] args) throws Exception {
  this.p = new PrintStream(cli.getReader().getTerminal().output());
  this.cli = cli;
  this.ansi = false; // cli.getReader().getTerminal().isAnsiSupported();
  if (args.length == 1) {
    usage(cli);
    return;
  }
  for (int i = 1; i < args.length; i++) {
    try {
      Logger logger = (Logger) NameRegistrar.get("logger." + args[i]);
      logger.addListener(this);
    } catch (NameRegistrar.NotFoundException e) {
      cli.println("Logger " + args[i] + " not found -- ignored.");
    }
  }
  // cli.getReader().readCharacter(new char[]{'q', 'Q'});
  cli.getReader().readLine();
  for (int i = 1; i < args.length; i++) {
    try {
      Logger logger = (Logger) NameRegistrar.get("logger." + args[i]);
      logger.removeListener(this);
    } catch (NameRegistrar.NotFoundException ignored) {
      // NOPMD OK to happen
    }
  }
}

相关文章