mirror of
https://github.com/digarok/gsplus.git
synced 2024-11-24 06:34:02 +00:00
it helps to add the actual code for logging
This commit is contained in:
parent
aa32d6f08f
commit
669f9c1814
29
src/glog.c
Normal file
29
src/glog.c
Normal 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
2
src/glog.h
Normal file
@ -0,0 +1,2 @@
|
||||
int glog(char *s);
|
||||
void gloghead();
|
Loading…
Reference in New Issue
Block a user