-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathloggertest.c
39 lines (27 loc) · 1 KB
/
loggertest.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include "pnd_logger.h"
// arbitrary warning level
#define PLOG_LOW 0
#define PLOG_MEDIUM 1
#define PLOG_HIGH 2
int main ( void ) {
pnd_log ( PLOG_LOW, "low message, should be ignored" );
/* normal operation -------------- */
pnd_log_to_stdout();
pnd_log ( PLOG_LOW, "low message, should go stdout once" );
/* ------------------------------- */
/* extra testing vvvvvvvvvvvvvvvvv
*/
pnd_log_to_stdout();
pnd_log ( PLOG_LOW, "low message, should go stdout twice" );
pnd_log_to_nil();
pnd_log_to_stdout();
pnd_log_set_pretext ( "loggertest" );
pnd_log ( PLOG_LOW, "low message, emit once, with pretext" );
pnd_log_set_filter ( PLOG_MEDIUM );
pnd_log ( PLOG_LOW, "low message, emit once, filter is medium+" );
pnd_log ( PLOG_MEDIUM, "medium message, emit once, filter is medium+" );
pnd_log ( PLOG_HIGH, "high message, emit once, filter is medium+" );
pnd_log_set_filter ( PLOG_LOW );
pnd_log ( PLOG_LOW, "low message, emit once, filter is low+ again" );
return ( 0 );
}