diff options
Diffstat (limited to 'src/log')
-rw-r--r-- | src/log/log.c | 32 | ||||
-rw-r--r-- | src/log/log.h | 25 |
2 files changed, 0 insertions, 57 deletions
diff --git a/src/log/log.c b/src/log/log.c deleted file mode 100644 index f6660cc..0000000 --- a/src/log/log.c +++ /dev/null @@ -1,32 +0,0 @@ -/* By using this work you agree to the terms and conditions in 'LICENCE.txt' */ - -#include "log.h" - -/* System */ -#include <stdarg.h> -#include <stdio.h> -#include <string.h> -#include <time.h> -#include <unistd.h> - - -void log_asdfghjklqwertzu( const char*level, const char*cLvl, const char*file, int line, const char*fmt, ... ) -{ - va_list args; - va_start( args, fmt ); - int isTTY = isatty(2); - const char *cRst = isTTY ? "\033[0m" : ""; - char *cTxt = isTTY ? "\033[90m" : ""; - cLvl = isTTY ? cLvl : ""; - char tBuf[20]; - const time_t t = time(0); - const char *tfmt = "%Y-%m-%d_%H:%M:%S"; - if( isTTY ){ tfmt += 9; } - strftime( tBuf,sizeof(tBuf), tfmt, localtime(&t) ); - const char *fileOnly = strrchr(file, '/') +1; - fprintf( stderr, "[%s%s%s %s%s%s %s%s:%d%s] ", - cTxt,tBuf,cRst, cLvl,level,cRst , cTxt,fileOnly,line,cRst ); - vfprintf( stderr, fmt, args ); - va_end( args ); -} - diff --git a/src/log/log.h b/src/log/log.h deleted file mode 100644 index e6520d2..0000000 --- a/src/log/log.h +++ /dev/null @@ -1,25 +0,0 @@ -/* By using this work you agree to the terms and conditions in 'LICENCE.txt' */ - -#ifndef INCGUARD_540e2cd36c1ba21909b922d45a94b7f7 -#define INCGUARD_540e2cd36c1ba21909b922d45a94b7f7 - -#include "commonbase.h" - - -#define LOG_FATAL( ... ) log_asdfghjklqwertzu("FATAL","\033[31m",__FILE__,__LINE__,__VA_ARGS__) -#define LOG_ERROR( ... ) log_asdfghjklqwertzu("ERROR","\033[31m",__FILE__,__LINE__,__VA_ARGS__) -#define LOG_WARN( ... ) log_asdfghjklqwertzu("WARN ","\033[33m",__FILE__,__LINE__,__VA_ARGS__) -#define LOG_INFO( ... ) log_asdfghjklqwertzu("INFO ","\033[36m",__FILE__,__LINE__,__VA_ARGS__) -#ifndef NDEBUG - #define LOG_DEBUG( ... ) log_asdfghjklqwertzu("DEBUG","\033[35m",__FILE__,__LINE__,__VA_ARGS__ ) - #define LOG_TRACE( ... ) log_asdfghjklqwertzu("TRACE","\033[94m",__FILE__,__LINE__,__VA_ARGS__ ) -#else - #define LOG_DEBUG( ... ) /* Debugging not enabled. Therefore ignore that log level. */ - #define LOG_TRACE( ... ) /* Debugging not enabled. Therefore ignore that log level. */ -#endif - - -void log_asdfghjklqwertzu( const char*level, const char*cLvl, const char*file, int line, const char*fmt, ... ); - - -#endif /* INCGUARD_540e2cd36c1ba21909b922d45a94b7f7 */ |