rxi / log.c

A simple logging library implemented in C99

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How to redirect messages to text file?

shipleyxie opened this issue · comments

I want to write logging messages to a text file, here is what i have done.

  FILE *fp_test = fopen("logging.txt","w");
  log_add_fp(fp_test,"INFO");
  log_info("%s is good man","rxi");
  fclose(fp_test);

But i got an empty file logging.txt.
How to achieve this?

Solved!

  FILE *fp_test = fopen("logging.txt","w");
  log_add_fp(fp_test, LOG_INFO);
  log_info("%s is good man","rxi");
  fclose(fp_test);