Tabnine Logo
BatfishLogger.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
org.batfish.common.BatfishLogger
constructor

Best Java code snippets using org.batfish.common.BatfishLogger.<init> (Showing top 18 results out of 315)

origin: batfish/batfish

 public BatfishJob(Settings settings) {
  _settings = settings;
  _logger = new BatfishLogger(_settings.getLogLevel(), _settings.getTimestamp());
 }
}
origin: batfish/batfish

 public static void main(String[] args) {
  checkArgument(args.length == 2, "Expected arguments: <input_dir> <output_dir>");
  Path inputPath = Paths.get(args[0]);
  Path outputPath = Paths.get(args[1]);
  Settings settings = new Settings(new String[] {"-storagebase", "/"});
  settings.setLogger(new BatfishLogger(BatfishLogger.LEVELSTR_WARN, false, System.out));

  new Batfish(settings, null, null, null, null, null, null, null, null)
    .flatten(inputPath, outputPath);
 }
}
origin: batfish/batfish

@Before
public void setup() {
 _logger = new BatfishLogger(BatfishLogger.LEVELSTR_OUTPUT, false);
}
origin: batfish/batfish

@Before
public void before() throws IOException {
 _containerDir = _folder.newFolder("container").toPath();
 _logger = new BatfishLogger(BatfishLogger.LEVELSTR_DEBUG, false);
 _storage =
   new FileBasedStorage(_containerDir.getParent(), _logger, (m, n) -> new AtomicInteger());
}
origin: batfish/batfish

public static void main(String[] args) {
 mainInit(args);
 _logger =
   new BatfishLogger(_settings.getLogLevel(), false, _settings.getLogFile(), false, true);
 mainRun(new BindPortFutures());
}
origin: batfish/batfish

   new BatfishLogger(_settings.getLogLevel(), false, _settings.getLogFile(), false, false);
 break;
case gendatamodel:
 _logger =
   new BatfishLogger(_settings.getLogLevel(), false, _settings.getLogFile(), false, false);
 break;
case genquestions:
   new BatfishLogger(_settings.getLogLevel(), false, _settings.getLogFile(), false, false);
 break;
case interactive:
  OutputStream os = new WriterOutputStream(pWriter, StandardCharsets.UTF_8);
  PrintStream ps = new PrintStream(os, true);
  _logger = new BatfishLogger(_settings.getLogLevel(), false, ps);
 } catch (Exception e) {
  System.err.printf("Could not initialize client: %s\n", e.getMessage());
origin: batfish/batfish

public static void main(String[] args) {
 mainInit(args);
 _mainLogger =
   new BatfishLogger(
     _mainSettings.getLogLevel(),
     _mainSettings.getTimestamp(),
     _mainSettings.getLogFile(),
     _mainSettings.getLogTee(),
     true);
 mainRun();
}
origin: batfish/batfish

private void checkProcessCommandErrorMessage(
  Command command, String[] parameters, String expected) throws Exception {
 Client client = new Client(new String[] {"-runmode", "gendatamodel"});
 File tempFile = _folder.newFile("writer");
 FileWriter writer = new FileWriter(tempFile);
 client._logger = new BatfishLogger("output", false);
 String[] args = ArrayUtils.addAll(new String[] {command.commandName()}, parameters);
 assertFalse(client.processCommand(args, writer));
 assertThat(client.getLogger().getHistory().toString(500), equalTo(expected));
 writer.close();
}
origin: batfish/batfish

private void testProcessCommandWithValidInput(
  Command command, String[] parameters, String expected) throws Exception {
 Client client = new Client(new String[] {"-runmode", "gendatamodel"});
 File tempFile = _folder.newFile("writer");
 FileWriter writer = new FileWriter(tempFile);
 String[] args = ArrayUtils.addAll(new String[] {command.commandName()}, parameters);
 client._logger = new BatfishLogger("output", false);
 assertTrue(client.processCommand(args, writer));
 assertThat(client.getLogger().getHistory().toString(500), equalTo(expected));
 writer.close();
}
origin: batfish/batfish

@Before
public void setup() {
 BatfishLogger logger = new BatfishLogger("debug", false);
 Main.mainInit(
   new String[] {
    "-containerslocation",
    _networksFolder.getRoot().toString(),
    "-templatedirs",
    _questionsTemplatesFolder.getRoot().toString()
   });
 Main.setLogger(logger);
 Main.initAuthorizer();
}
origin: batfish/batfish

@Test
public void testDefaultCase() throws Exception {
 Client client = new Client(new String[] {"-runmode", "gendatamodel"});
 File tempFile = _folder.newFile("writer");
 FileWriter writer = new FileWriter(tempFile);
 client._logger = new BatfishLogger("output", false);
 String[] args = new String[] {"non-exist command"};
 String expected = "Command failed: Not a valid command: \"non-exist command\"\n";
 assertFalse(client.processCommand(args, writer));
 assertThat(client.getLogger().getHistory().toString(500), equalTo(expected));
}
origin: batfish/batfish

new BatfishLogger(
  settings.getLogLevel(),
  settings.getTimestamp(),
origin: batfish/batfish

 @Test
 public void testEmptyQuestionTemplateDir() throws Exception {
  JSONObject testQuestion = new JSONObject();
  testQuestion.put(
    "instance",
    new JSONObject()
      .put("instanceName", "testQuestion")
      .put("description", "test question description"));
  Path questionJsonPath = _folder.newFile("testquestion.json").toPath();
  CommonUtil.writeFile(questionJsonPath, testQuestion.toString());

  Main.mainInit(new String[0]);
  Main.setLogger(new BatfishLogger("debug", false));
  Main.getSettings()
    .setQuestionTemplateDirs(ImmutableList.of(_folder.getRoot().toPath(), Paths.get("")));

  Map<String, String> questionTemplates = getQuestionTemplates();

  assertThat(questionTemplates, notNullValue());
  assertThat(questionTemplates.keySet(), hasSize(1));
  // Both templates should be present
  assertThat(
    questionTemplates,
    IsMapContaining.hasEntry(
      "testquestion",
      "{\"instance\":{\"instanceName\":\"testQuestion\",\"description\":\"test question description\"}}"));
 }
}
origin: batfish/batfish

public static void initWorkManager(IdManager idManager, StorageProvider storage) {
 BatfishLogger logger = new BatfishLogger("debug", false);
 Main.mainInit(new String[] {});
 Main.setLogger(logger);
 Main.initAuthorizer();
 Main.setWorkMgr(new WorkMgr(Main.getSettings(), logger, idManager, storage));
}
origin: batfish/batfish

@Test
public void testLoadQuestionsNames() throws Exception {
 Client client =
   new Client(new String[] {"-runmode", "gendatamodel", "-prettyanswers", "false"});
 JSONObject testQuestion = new JSONObject();
 testQuestion.put(
   "instance",
   new JSONObject()
     .put("instanceName", "testQuestionName")
     .put("description", "test question description"));
 Path questionJsonPath = _folder.newFile("testquestion.json").toPath();
 CommonUtil.writeFile(questionJsonPath, testQuestion.toString());
 client._logger = new BatfishLogger("output", false);
 client.processCommand(
   new String[] {LOAD_QUESTIONS.commandName(), questionJsonPath.getParent().toString()}, null);
 // Reading the answer written by load-questions
 Answer answerLoadQuestions =
   _mapper.readValue(
     client.getLogger().getHistory().toString(BatfishLogger.LEVEL_OUTPUT), Answer.class);
 LoadQuestionAnswerElement ae =
   (LoadQuestionAnswerElement) answerLoadQuestions.getAnswerElements().get(0);
 // Checking that question name in answer element matches instanceName in file
 assertEquals("testQuestionName", ae.getAdded().first());
}
origin: batfish/batfish

@Before
public void init() throws Exception {
 Main.mainInit(new String[0]);
 Main.setLogger(new BatfishLogger("debug", false));
 _workQueueMgr = new WorkQueueMgr(Type.memory, Main.getLogger());
 WorkMgrTestUtils.initWorkManager(_folder);
 Main.getWorkMgr().initNetwork(NETWORK, null);
 _networkId = Main.getWorkMgr().getIdManager().getNetworkId(NETWORK);
}
origin: batfish/batfish

public static void initWorkManager(TemporaryFolder folder) throws Exception {
 BatfishLogger logger = new BatfishLogger("debug", false);
 Main.mainInit(new String[] {"-containerslocation", folder.getRoot().toString()});
 Main.setLogger(logger);
 Main.initAuthorizer();
 Main.setWorkMgr(
   new WorkMgr(
     Main.getSettings(),
     logger,
     new FileBasedIdManager(Main.getSettings().getContainersLocation()),
     new FileBasedStorage(Main.getSettings().getContainersLocation(), logger)));
}
origin: batfish/batfish

private void initNetwork() {
 Settings settings = new Settings(new String[] {});
 BatfishLogger logger = new BatfishLogger("debug", false);
 Main.mainInit(
   new String[] {
    "-containerslocation",
    _networksFolder.getRoot().toString(),
    "-templatedirs",
    _questionsTemplatesFolder.getRoot().toString()
   });
 Main.setLogger(logger);
 Main.initAuthorizer();
 WorkMgr manager =
   new WorkMgr(
     settings,
     logger,
     new FileBasedIdManager(Main.getSettings().getContainersLocation()),
     new FileBasedStorage(Main.getSettings().getContainersLocation(), logger));
 Main.setWorkMgr(manager);
 manager.initNetwork(_networkName, null);
 manager.getIdManager().assignNetwork(_networkName, _networkId);
 _service = new WorkMgrService();
}
org.batfish.commonBatfishLogger<init>

Popular methods of BatfishLogger

  • debugf
  • errorf
  • info
  • error
  • infof
  • warnf
  • debug
  • getLogLevel
  • getLogLevelStr
  • output
  • append
  • getHistory
  • append,
  • getHistory,
  • isActive,
  • setLogLevel,
  • warn,
  • close,
  • getElapsedTime,
  • getPrintStream,
  • getRotatedLogFilename

Popular in Java

  • Making http requests using okhttp
  • getResourceAsStream (ClassLoader)
  • getExternalFilesDir (Context)
  • getSystemService (Context)
  • FileNotFoundException (java.io)
    Thrown when a file specified by a program cannot be found.
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • String (java.lang)
  • Timestamp (java.sql)
    A Java representation of the SQL TIMESTAMP type. It provides the capability of representing the SQL
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • CountDownLatch (java.util.concurrent)
    A synchronization aid that allows one or more threads to wait until a set of operations being perfor
  • Best IntelliJ plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now