]> arthur.barton.de Git - netdata.git/blobdiff - src/log.c
code optimizations; added temperature charts.d plugin
[netdata.git] / src / log.c
index a2a7eb0e2e0af5f4ef116f1608196adce4818d8a..c7b8283bd26186719e40715043fea9d74f5f8114 100755 (executable)
--- a/src/log.c
+++ b/src/log.c
@@ -6,10 +6,13 @@
 #include <stdlib.h>
 
 #include "log.h"
+#include "common.h"
+
 
 // ----------------------------------------------------------------------------
 // LOG
 
+const char *program_name = "";
 unsigned long long debug_flags = DEBUG;
 
 int silent = 0;
@@ -43,7 +46,7 @@ void debug_int( const char *file, const char *function, const unsigned long line
 
        log_date(stdout);
        va_start( args, fmt );
-       fprintf(stdout, "DEBUG (%04lu@%-10.10s:%-15.15s): ", line, file, function);
+       fprintf(stdout, "DEBUG (%04lu@%-10.10s:%-15.15s): %s: ", line, file, function, program_name);
        vfprintf( stdout, fmt, args );
        va_end( args );
        fprintf(stdout, "\n");
@@ -62,8 +65,8 @@ void info_int( const char *file, const char *function, const unsigned long line,
        log_date(stderr);
 
        va_start( args, fmt );
-       if(debug_flags) fprintf(stderr, "INFO (%04lu@%-10.10s:%-15.15s): ", line, file, function);
-       else            fprintf(stderr, "INFO: ");
+       if(debug_flags) fprintf(stderr, "INFO (%04lu@%-10.10s:%-15.15s): %s: ", line, file, function, program_name);
+       else            fprintf(stderr, "INFO: %s: ", program_name);
        vfprintf( stderr, fmt, args );
        va_end( args );
 
@@ -83,8 +86,8 @@ void error_int( const char *file, const char *function, const unsigned long line
        log_date(stderr);
 
        va_start( args, fmt );
-       if(debug_flags) fprintf(stderr, "ERROR (%04lu@%-10.10s:%-15.15s): ", line, file, function);
-       else            fprintf(stderr, "ERROR: ");
+       if(debug_flags) fprintf(stderr, "ERROR (%04lu@%-10.10s:%-15.15s): %s: ", line, file, function, program_name);
+       else            fprintf(stderr, "ERROR: %s: ", program_name);
        vfprintf( stderr, fmt, args );
        va_end( args );
 
@@ -108,8 +111,8 @@ void fatal_int( const char *file, const char *function, const unsigned long line
        log_date(stderr);
 
        va_start( args, fmt );
-       if(debug_flags) fprintf(stderr, "FATAL (%04lu@%-10.10s:%-15.15s): ", line, file, function);
-       else            fprintf(stderr, "FATAL: ");
+       if(debug_flags) fprintf(stderr, "FATAL (%04lu@%-10.10s:%-15.15s): %s: ", line, file, function, program_name);
+       else            fprintf(stderr, "FATAL: %s: ", program_name);
        vfprintf( stderr, fmt, args );
        va_end( args );