#include "ucore_logging.h" #include "ucore_utils.h" #include enum { MAIN, CC, HO }; struct uc_log_module module_arr[] = { { MAIN, "MAIN", "Main module", UC_LL_WARNING }, { CC, "CC", "Call Control module", UC_LL_DEBUG, }, { HO, "HO", "Handover module", UC_LL_DEBUG } }; struct uc_log_modules modules = { .mods = module_arr, .cnt = ARRAY_SIZE(module_arr), }; int main(int argc, char *argv[]) { struct uc_log_destination *dest = uc_log_new_stderr(UC_LL_INFO, 0); uc_log_init(&modules); 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); 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_LOGF( UC_LL_INFO, MAIN, "Test MAIN warning 2\n" ); return 1; }