aboutsummaryrefslogtreecommitdiff
path: root/src/util/common_logging.c
diff options
context:
space:
mode:
authorNils Durner <durner@gnunet.org>2009-05-29 21:43:58 +0000
committerNils Durner <durner@gnunet.org>2009-05-29 21:43:58 +0000
commit8dbf6bb060caed8132faf75e0d7fec250c9653c1 (patch)
tree6b60c3412441a043acdd59668e000fdc61cc0bf0 /src/util/common_logging.c
parentf195416e33659a11f16600ac56eded846d419ae8 (diff)
downloadgnunet-8dbf6bb060caed8132faf75e0d7fec250c9653c1.tar.gz
gnunet-8dbf6bb060caed8132faf75e0d7fec250c9653c1.zip
fix MinGW
Diffstat (limited to 'src/util/common_logging.c')
-rw-r--r--src/util/common_logging.c21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/util/common_logging.c b/src/util/common_logging.c
index 4068ed94b..2fdd17ca7 100644
--- a/src/util/common_logging.c
+++ b/src/util/common_logging.c
@@ -123,6 +123,8 @@ static struct CustomLogger *loggers;
123 */ 123 */
124static unsigned int skip_log; 124static unsigned int skip_log;
125 125
126static FILE *GNUNET_stderr;
127
126/** 128/**
127 * Convert a textual description of a loglevel 129 * Convert a textual description of a loglevel
128 * to the respective GNUNET_GE_KIND. 130 * to the respective GNUNET_GE_KIND.
@@ -163,9 +165,9 @@ GNUNET_log_setup (const char *comp, const char *loglevel, const char *logfile)
163 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "fopen", logfile); 165 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "fopen", logfile);
164 return GNUNET_SYSERR; 166 return GNUNET_SYSERR;
165 } 167 }
166 if (stderr != NULL) 168 if (GNUNET_stderr != NULL)
167 fclose (stderr); 169 fclose (GNUNET_stderr);
168 stderr = altlog; 170 GNUNET_stderr = altlog;
169 return GNUNET_OK; 171 return GNUNET_OK;
170} 172}
171 173
@@ -220,8 +222,8 @@ output_message (enum GNUNET_ErrorType kind,
220 const char *comp, const char *datestr, const char *msg) 222 const char *comp, const char *datestr, const char *msg)
221{ 223{
222 struct CustomLogger *pos; 224 struct CustomLogger *pos;
223 if (stderr != NULL) 225 if (GNUNET_stderr != NULL)
224 fprintf (stderr, "%s %s %s %s", datestr, comp, 226 fprintf (GNUNET_stderr, "%s %s %s %s", datestr, comp,
225 GNUNET_error_type_to_string (kind), msg); 227 GNUNET_error_type_to_string (kind), msg);
226 pos = loggers; 228 pos = loggers;
227 while (pos != NULL) 229 while (pos != NULL)
@@ -396,6 +398,13 @@ GNUNET_i2s (const struct GNUNET_PeerIdentity *pid)
396 return (const char *) ret.encoding; 398 return (const char *) ret.encoding;
397} 399}
398 400
399 401/**
402 * Initializer
403 */
404void __attribute__ ((constructor))
405GNUNET_util_cl_init()
406{
407 GNUNET_stderr = stderr;
408}
400 409
401/* end of common_logging.c */ 410/* end of common_logging.c */