olaf@57: #include "logging.h" olaf@57: #include olaf@57: olaf@57: UcxLogger *ucx_logger_new(FILE *stream, unsigned int level) { olaf@57: UcxLogger *logger = (UcxLogger*) malloc(sizeof(UcxLogger)); olaf@57: if (logger != NULL) { olaf@57: logger->stream = stream; olaf@57: logger->level = level; olaf@57: } olaf@57: olaf@57: return logger; olaf@57: } olaf@57: olaf@57: void ucx_logger_log(UcxLogger *logger, unsigned int level, sstr_t message) { olaf@57: if (level <= logger->level) { olaf@57: fwrite(message.ptr, 1, message.length, logger->stream); olaf@57: fflush(logger->stream); olaf@57: } olaf@57: }