]> pilppa.org Git - libplp.git/blob - src_test/test_logs.c
added new helper function for getting byte array as hex-str.
[libplp.git] / src_test / test_logs.c
1 /*
2  * test_ha.c
3  *
4  *  Created on: Sep 16, 2010
5  *      Author: lamikr
6  */
7
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <unistd.h>
11 #include <sys/types.h>
12 #include <sys/wait.h>
13
14 #include "log.h"
15
16 #include "../src/str_util.h"
17
18 void test_logging() {
19         log_debug("debug");
20         log_debug("debug v%d\n", 2);
21         log_info("info\n");
22         log_info("info v%d\n", 2);
23         log_warning("warning\n");
24         log_warning("warning v%d\n", 2);
25         log_error("error\n");
26         log_error("error v%d\n", 2);
27 }
28
29 void test_str_util() {
30         char    *res_str;
31         char    b_arr[] = {0x1, 0x11, 0x21, 0x31};
32
33         res_str = get_as_hex_str(b_arr, 4);
34         log_info("bytes: %s\n", res_str);
35         free(res_str);
36 }
37
38 int main(int argc, char** argv)
39 {
40         test_logging();
41         test_str_util();
42         return 0;
43 }