Set back to the default log function after using an override

pull/6863/head
Vijay Pai 9 years ago
parent 488fd0ec31
commit 8b48191854
  1. 4
      src/core/lib/support/log.c
  2. 2
      test/core/support/log_test.c

@ -96,4 +96,6 @@ void gpr_log_verbosity_init() {
}
}
void gpr_set_log_function(gpr_log_func f) { g_log_func = f; }
void gpr_set_log_function(gpr_log_func f) {
g_log_func = f ? f : gpr_default_log;
}

@ -78,11 +78,13 @@ int main(int argc, char **argv) {
gpr_set_log_function(test_callback);
gpr_log_message(GPR_INFO, "hello 1 2 3");
gpr_log(GPR_INFO, "hello %d %d %d", 1, 2, 3);
gpr_set_log_function(NULL);
/* gpr_log_verbosity_init() will be effective only once, and only before
* gpr_set_log_verbosity() is called */
gpr_setenv("GRPC_VERBOSITY", "ERROR");
gpr_log_verbosity_init();
test_log_function_reached(GPR_ERROR);
test_log_function_unreached(GPR_INFO);
test_log_function_unreached(GPR_DEBUG);

Loading…
Cancel
Save