log-timestamp.c
Version:
A logger function with the current timestamp prepended
67 lines (48 loc) • 1.04 kB
Markdown
log-timestamp.c
===============
A logger function with the current timestamp prepended
Usage
-----
First install this package
npm install log-timestamp.c
Then create a program that `require`s this function
`test.c`
``` c
int main(int argc, char **argv) {
int i;
for (i = 0; i < argc; i++)
LOG("%s\n", argv[i]);
return 0;
}
```
Finally compile the program using `dotc` and execute it
```
$ dotc test.c
$ ./a.out testing this out
[ ] ./a.out
[ ] testing
[ ] this
[ ] out
```
Copy `log-timestamp.{h,c}` to your project, and include the header
file as necessary
`test.c`
``` c
int main(int argc, char **argv) {
int i;
for (i = 0; i < argc; i++)
LOG("%s\n", argv[i]);
return 0;
}
```
And the program will execute as above
Functions
---------
License
-------
MIT