#include "log.h" int log_register_sub(int sub, int level, int loc, char *location) { FILE *fd=NULL; if ((sub < LOG_SUB_NONE) || (sub > LOG_SUB_NET)) { printf("Cant register logging\n"); return -1; } if (loc == LOG_LOC_FILE) { fd = fopen(location, "a"); if (fd == NULL) { printf("Cant open file for logging %s\n", location); return -1; } } __logs[sub].disabled = 0; __logs[sub].sub = sub; __logs[sub].level = level; __logs[sub].location = loc; __logs[sub].fd = fd; __logs[sub].fname = location; return 0; } int log_init() { int i; for (i=0;i