示例#1
0
文件: log_test.c 项目: Darma/trema
void
test_LOGGING_LEVEL_overrides_logging_level() {
  setenv( "LOGGING_LEVEL", "DEBUG", 1 );
  set_logging_level( "critical" );
  init_log( "tetris", get_trema_tmp(), LOGGING_TYPE_FILE );
  assert_int_equal( LOG_DEBUG, get_logging_level() );
}
示例#2
0
static void
test_get_trema_tmp_if_not_initialized() {
  assert_string_equal( "/tmp", get_trema_tmp() );

  unset_trema_home();
  unset_trema_tmp();
}
示例#3
0
文件: log_test.c 项目: Darma/trema
void
test_init_log_opens_syslog() {
  const char *ident = "tetris";
  expect_string( mock_openlog, ident, ident );
  expect_value( mock_openlog, option, LOG_NDELAY );
  expect_value( mock_openlog, facility, LOG_USER );
  init_log( ident, get_trema_tmp(), LOGGING_TYPE_SYSLOG );
  assert_true( syslog_initialized );
}
示例#4
0
文件: log_test.c 项目: Darma/trema
static void
setup_logger_syslog() {
  setup();
  const char *ident = "log_test.c";
  expect_string( mock_openlog, ident, ident );
  expect_value( mock_openlog, option, LOG_NDELAY );
  expect_value( mock_openlog, facility, LOG_USER );
  init_log( ident, get_trema_tmp(), LOGGING_TYPE_SYSLOG );
}
示例#5
0
static void
test_get_trema_tmp() {
  setenv( "TREMA_TMP", "/var/tmp", 1 );

  set_trema_tmp();

  assert_string_equal( "/var/tmp", get_trema_tmp() );

  unset_trema_home();
  unset_trema_tmp();
}
示例#6
0
文件: log_test.c 项目: nhst/trema
void
test_init_log_reads_LOGING_LEVEL_environment_variable() {
  setenv( "LOGGING_LEVEL", "CRITICAL", 1 );
  init_log( "tetris", get_trema_tmp(), false );
  assert_int_equal( LOG_CRITICAL, get_logging_level() );
}
示例#7
0
文件: log_test.c 项目: nhst/trema
static void
setup_daemon_logger() {
  setup();
  init_log( "log_test.c", get_trema_tmp(), true );
}
示例#8
0
文件: log_test.c 项目: nhst/trema
static void
setup_logger() {
  setup();
  init_log( "log_test.c", get_trema_tmp(), false );
}
示例#9
0
文件: log_test.c 项目: Darma/trema
void
test_set_logging_level_is_called_before_init_log() {
  set_logging_level( "critical" );
  init_log( "tetris", get_trema_tmp(), LOGGING_TYPE_FILE );
  assert_int_equal( LOG_CRIT, get_logging_level() );
}
示例#10
0
文件: log_test.c 项目: Darma/trema
static void
setup_logger_file_stdout() {
  setup();
  init_log( "log_test.c", get_trema_tmp(), LOGGING_TYPE_FILE | LOGGING_TYPE_STDOUT );
}
示例#11
0
文件: log_test.c 项目: Darma/trema
static void
setup_logger_file() {
  setup();
  init_log( "log_test.c", get_trema_tmp(), LOGGING_TYPE_FILE );
}