created logger-app source file
This commit is contained in:
parent
e0f0ad73b5
commit
b57cd2b827
50
src/logger/app/main.c
Normal file
50
src/logger/app/main.c
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include <why2.h>
|
||||||
|
|
||||||
|
int main(void)
|
||||||
|
{
|
||||||
|
why2_log_file log_file = why2_init_logger(WHY2_TEST_DIRECTORY); //INIT LOGGER
|
||||||
|
char *key = why2_generate_key(strlen(WHY2_LOGGER_TEST_TEXT) * 2);
|
||||||
|
|
||||||
|
//SET FLAGS
|
||||||
|
why2_set_flags
|
||||||
|
(
|
||||||
|
(why2_input_flags)
|
||||||
|
{
|
||||||
|
1,
|
||||||
|
1,
|
||||||
|
0
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
why2_set_log_flags
|
||||||
|
(
|
||||||
|
(why2_log_flags)
|
||||||
|
{
|
||||||
|
key
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
why2_write_log(log_file.file, WHY2_LOGGER_TEST_TEXT); //WRITE
|
||||||
|
|
||||||
|
//PRINT
|
||||||
|
printf
|
||||||
|
(
|
||||||
|
"Hi.\n"
|
||||||
|
"This is a simple application written using WHY2's logger module.\n\n"
|
||||||
|
|
||||||
|
"Come on, open \"%s\"... I wrote something special there :)\n\n"
|
||||||
|
|
||||||
|
"Thank you so much for supporting this project!\n",
|
||||||
|
|
||||||
|
log_file.filename
|
||||||
|
);
|
||||||
|
|
||||||
|
//DEALLOCATION
|
||||||
|
why2_deallocate(key);
|
||||||
|
why2_deallocate_logger(log_file);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user