feat: logging
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
# sonuva
|
||||||
|
|
||||||
|
sonuva is a c helper single header library
|
||||||
|
|
||||||
|
feat:
|
||||||
|
|
||||||
|
[ ] String Tokenizer
|
||||||
|
[ ] File I/O
|
||||||
|
|
||||||
Executable
BIN
Binary file not shown.
@@ -1,10 +1,26 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
void LOG_INFO(char *str) { printf("+ [INFO] %s\n", str); }
|
||||||
|
|
||||||
|
void LOG_LEVEL(char *str, char *level) {
|
||||||
|
if (strcmp(level, "warn") == 0) {
|
||||||
|
printf("! [WARN] %s\n", str);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(level, "fatal") == 0) {
|
||||||
|
printf("!! [FATAL] %s\n", str);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Driver Code
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
|
LOG_INFO("This is a Log");
|
||||||
|
LOG_LEVEL("This is a Warning", "warn");
|
||||||
|
/* LOG("HELLO"); */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user