This helper already exists in library/log.c
It is called dnet_log_raw()
Please use that one instead of writing your own