LogWatcher implements PodEventHandler, Closeable { public static long getLogLimitBytes(Map<String, String> startOptions) { if (startOptions == null || startOptions.isEmpty() || !startOptions.containsKey(DEBUG_WORKSPACE_START_LOG_LIMIT_BYTES)) { return DEFAULT_LOG_LIMIT_BYTES; } else { try { return Long.parseLong(startOptions.get(DEBUG_WORKSPACE_START_LOG_LIMIT_BYTES)); } catch (NumberFormatException nfe) { LOG.debug( "failed to parse log limit bytes value from startOptions. Value '{}'", startOptions.get(DEBUG_WORKSPACE_START_LOG_LIMIT_BYTES), nfe); return DEFAULT_LOG_LIMIT_BYTES; } } } LogWatcher(
      KubernetesClientFactory clientFactory,
      RuntimeEventsPublisher eventsPublisher,
      String workspaceId,
      String namespace,
      Set<String> podsOfInterest,
      Executor executor,
      LogWatchTimeouts timeouts,
      long inputStreamLimit); void addLogHandler(PodLogHandler handler); @Override void handle(PodEvent event); void close(); void close(boolean needWait); @Override String toString(); static long getLogLimitBytes(Map<String, String> startOptions); static boolean shouldWatchLogs(Map<String, String> startOptions); static final Long DEFAULT_LOG_LIMIT_BYTES; }
@Test(dataProvider = "logLimitData") public void testGettingLogLimitBytes(Map<String, String> startOptions, long expectedLimit) { assertEquals(LogWatcher.getLogLimitBytes(startOptions), expectedLimit); }