Implement setting log mask string on a destination.
Improve logging docs
This commit is contained in:
+10
-4
@@ -37,25 +37,31 @@ int main(int argc, char *argv[])
|
||||
{
|
||||
struct uc_log_destination *dest;
|
||||
uc_log_init(&modules);
|
||||
dest = uc_log_new_stderr(UC_LL_INFO, 0);
|
||||
uc_log_add_destination(dest);
|
||||
dest = uc_log_new_file("test.log", UC_LL_INFO, 1);
|
||||
uc_log_add_destination(dest);
|
||||
dest = uc_log_new_syslog("log.test", LOG_DAEMON, UC_LL_INFO, 0);
|
||||
uc_log_add_destination(dest);
|
||||
dest = uc_log_new_stderr(UC_LL_INFO, 0);
|
||||
uc_log_add_destination(dest);
|
||||
UC_LOGF( UC_LL_INFO, CC, "Test cc info %d\n", 2);
|
||||
UC_LOGF( UC_LL_WARNING, HO, "Test HO warning%d\n", 2);
|
||||
UC_LOGF( UC_LL_INFO, MAIN, "Test MAIN info \n" );
|
||||
UC_LOGF( UC_LL_WARNING, MAIN, "Test MAIN warning\n" );
|
||||
|
||||
uc_log_module_set_loglevel(MAIN, UC_LL_INFO);
|
||||
uc_log_destination_set_module_loglevel(dest, MAIN, UC_LL_INFO);
|
||||
UC_LOGF( UC_LL_INFO, MAIN, "Test MAIN INFO 2\n" );
|
||||
|
||||
UC_LOGFR(UC_LL_INFO, MAIN, "Test RAW logging 1\n" );
|
||||
|
||||
uc_log_module_set_loglevel(MAIN, UC_LL_WARNING);
|
||||
uc_log_destination_set_module_loglevel(dest,MAIN, UC_LL_WARNING);
|
||||
UC_LOGF( UC_LL_INFO, MAIN, "Test MAIN INFO 3\n" );
|
||||
|
||||
uc_log_destination_set_loglevel(dest, UC_LL_DEBUG);
|
||||
UC_LOGF( UC_LL_DEBUG, MAIN, "Test MAIN DEBUG SHOULD NOT SHOW\n" );
|
||||
//uc_log_destination_set_module_loglevel(dest, MAIN, UC_LL_INFO);
|
||||
uc_log_destination_set_mask(dest, "HO=ERROR:MAIN=DEBUG:HO=DEBUG");
|
||||
UC_LOGF( UC_LL_DEBUG, MAIN, "Test MAIN DEBUG SHOULD SHOW\n" );
|
||||
|
||||
uc_log_delete_destination(dest);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user