diff --git a/utility.c b/utility.c index c4a19dc..836bbb1 100644 --- a/utility.c +++ b/utility.c @@ -73,4 +73,35 @@ void md5(char *string, char outputBuffer[33]){ sprintf(outputBuffer + (i * 2), "%02x", hash[i]); } outputBuffer[64] = 0; -} \ No newline at end of file +} + +void logger_log(const char* _Format, ...){ + FILE * fp; + fp = fopen("log.txt","a"); + time_t timer; + char buf[26]; + struct tm* tm_info; + + time(&timer); + tm_info = localtime(&timer); + + strftime(buf, 26, "%Y.%m.%d. %H:%M:%S", tm_info); + char string[513]; + printf("[%s]\t",buf); + fprintf(fp,"[%s]\t"); + va_list args; + va_start (args, _Format); + vprintf(_Format,args); + vfprintf(fp,_Format,args); + va_end(args); + fprintf(fp,"\n"); + printf(stdout,"\n"); + + fclose(fp); +} + +void map_dump(map *m, int len) { + for (int i = 0; i #include #include +#include #include #include #include @@ -29,4 +30,9 @@ bool map_isFound(map m[],int len, char* key); char* map_getValue(map m[],int len, char* key); -void md5(char *string, char outputBuffer[33]); \ No newline at end of file +//Debug-hoz hasznos +void map_dump(map m[],int len); + +void md5(char *string, char outputBuffer[33]); + +void logger_log(const char* _Format, ...); \ No newline at end of file