]> git.imager.perl.org - imager.git/blobdiff - log.c
RT 58761: fix Imager->new(data => $data)
[imager.git] / log.c
diff --git a/log.c b/log.c
index 979c3a9bc872e65c34b98b4de31a600b8673a0f7..a32db1b5e271df8fe5c9ad42d08a7b098b9bf27e 100644 (file)
--- a/log.c
+++ b/log.c
@@ -1,4 +1,6 @@
+#include "imconfig.h"
 #include "log.h"
+#include <stdlib.h>
 
 #define DTBUFF 50
 #define DATABUFF DTBUFF+3+10+1+5+1+1
@@ -17,7 +19,7 @@ static char  data_buffer[DATABUFF];
  */
 
 void
-init_log(const char* name,int level) {
+i_init_log(const char* name,int level) {
   log_level = level;
   if (level < 0) {
     lg_file = NULL;
@@ -31,11 +33,12 @@ init_log(const char* name,int level) {
       }
     }
   }
+  setvbuf(lg_file, NULL, _IONBF, BUFSIZ);
   mm_log((0,"Imager - log started (level = %d)\n", level));
 }
 
 void
-m_fatal(int exitcode,const char *fmt, ... ) {
+i_fatal(int exitcode,const char *fmt, ... ) {
   va_list ap;
   time_t timi;
   struct tm *str_tm;
@@ -56,18 +59,25 @@ m_fatal(int exitcode,const char *fmt, ... ) {
 
 /*
  * Logging is inactive - insert dummy functions
+ */
 
+void i_init_log(const char* name,int onoff) {}
+void i_fatal(int exitcode,const char *fmt, ... ) { exit(exitcode); }
 
-void init_log(const char* name,int onoff) {}
-void m_fatal(int exitcode,const char *fmt, ... ) { return(exitcode); }
-
-*/
 
 #endif
 
+/*
+=item i_loog(level, format, ...)
+=category Logging
+
+This is an internal function called by the mm_log() macro.
+
+=cut
+*/
 
 void
-m_loog(int level,const char *fmt, ... ) {
+i_loog(int level,const char *fmt, ... ) {
   va_list ap;
   if (level > log_level) return;
   if (lg_file != NULL) {
@@ -80,9 +90,17 @@ m_loog(int level,const char *fmt, ... ) {
   }
 }
 
+/*
+=item i_lhead(file, line)
+=category Logging
+
+This is an internal function called by the mm_log() macro.
+
+=cut
+*/
 
 void
-m_lhead(const char *file, int line) {
+i_lhead(const char *file, int line) {
   time_t timi;
   struct tm *str_tm;