#include "ntr.h" static int ntr_log_levels[NTR_DEP_MAX] = { NTR_LEVEL_DEFAULT }; static FILE *ntr_out; void ntr_init() { ntr_out = stdout; } void ntr(int dep, int level, const char *fmt, ...) { va_list vl; va_start(vl, fmt); if (dep < NTR_DEP_MAX && level <= ntr_log_levels[dep]) { vfprintf(ntr_out, fmt, vl); } va_end(vl); } void ntr_set_level(int dep, int level) { if (dep < NTR_DEP_MAX) { ntr_log_levels[dep] = level; } } void ntr_set_output(FILE *f) { if (f != NULL) { ntr_out = f; } } int ntr_get_level(int dep) { if (dep < NTR_DEP_MAX) { return ntr_log_levels[dep]; } return 0; }