Example #1
0
CapturingTestLogger::CapturingTestLogger(int level) : BaseTestLogger()
{
  take_over();
  setPrinting(PrintingTestLogger::DEFAULT.isPrinting());
  setLoggingLevel(level);
  pthread_mutex_init(&_logger_lock, NULL);
};
Example #2
0
void PrintingTestLogger::setupFromEnvironment()
{
  // Set logging to the specified level if specified in the environment.
  // NOISY=T:5 sets the level to 5.
  char* val = getenv("NOISY");
  bool is_noisy = ((val != NULL) &&
                   (strchr("TtYy", val[0]) != NULL));
  int level = DEFAULT_LOGGING_LEVEL;

  if (val != NULL)
  {
    val = strchr(val, ':');

    if (val != NULL)
    {
      level = strtol(val + 1, NULL, 10);
    }
  }

  setPrinting(is_noisy);
  setLoggingLevel(level);
}