3030/* TODO remove global variables */
3131static int stdout_lines ;
3232static FILE * log_file ;
33- static bool g_logtostderr ;
3433
3534static void print (void * logger , const char * key , const char * value_fmt , ...)
3635{
@@ -144,7 +143,7 @@ static void logging(const char *file, int line, const char *func,
144143 if (thread_id == -1 )
145144 thread_id = getpid ();
146145 path = strdup (file );
147- fprintf (g_logtostderr ? stderr : log_file ,
146+ fprintf (log_file ,
148147 "%c%02d%02d %02d:%02d:%02d.%06ld %3d %6d %s:%d] %s: %s\n" ,
149148 level_char , tm .tm_mon + 1 , tm .tm_mday , tm .tm_hour , tm .tm_min ,
150149 tm .tm_sec , ts .tv_nsec / 1000 , stdout_lines , thread_id ,
@@ -156,7 +155,7 @@ static void logging(const char *file, int line, const char *func,
156155 if (size > sizeof (buf ))
157156 free (msg );
158157 if (level == FATAL || level == ERROR || level == WARNING )
159- fflush (g_logtostderr ? stderr : log_file );
158+ fflush (log_file );
160159 if (level == FATAL ) {
161160 fclose (log_file );
162161 fflush (stdout );
@@ -205,11 +204,6 @@ static void log_info(void *logger, const char *file, int line,
205204 va_end (argp );
206205}
207206
208- static void logtostderr (void * logger )
209- {
210- g_logtostderr = true;
211- }
212-
213207static void logtonull ()
214208{
215209 log_file = fopen ("/dev/null" , "w" );
@@ -246,7 +240,6 @@ void logging_init(struct callbacks *cb, int argc, char **argv)
246240 cb -> log_error = log_error ;
247241 cb -> log_warn = log_warn ;
248242 cb -> log_info = log_info ;
249- cb -> logtostderr = logtostderr ;
250243}
251244
252245void logging_exit (struct callbacks * cb )
0 commit comments