it helps to add the actual code for logging

This commit is contained in:
Dagen Brock 2016-10-28 12:14:45 -05:00
parent aa32d6f08f
commit 669f9c1814
2 changed files with 31 additions and 0 deletions

29
src/glog.c Normal file
View File

@ -0,0 +1,29 @@
#include <stdio.h>
#include <time.h>
int glog(char *s) {
time_t timer;
char buffer[26];
struct tm* tm_info;
time(&timer);
tm_info = localtime(&timer);
strftime(buffer, 26, "%Y-%m-%d %H:%M:%S", tm_info);
printf("%s - %s\n", buffer, s);
return 0;
}
// only print partial, interim solution for not supporting printf style calling
void gloghead() {
time_t timer;
char buffer[26];
struct tm* tm_info;
time(&timer);
tm_info = localtime(&timer);
strftime(buffer, 26, "%Y-%m-%d %H:%M:%S", tm_info);
printf("%s - ", buffer);
}

2
src/glog.h Normal file
View File

@ -0,0 +1,2 @@
int glog(char *s);
void gloghead();