Initial import of libucore

This commit is contained in:
Nils O. Selåsdal
2012-10-29 23:07:32 +01:00
commit ed3866e49a
79 changed files with 6181 additions and 0 deletions
+53
View File
@@ -0,0 +1,53 @@
#include "ucore_logging.h"
#include "ucore_utils.h"
#include <syslog.h>
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;
}