[Change] WARN and ERR now generate asserts in debug mode.
This commit is contained in:
parent
028f77f78a
commit
a234593091
1
AUTHORS
1
AUTHORS
@ -14,6 +14,7 @@ Contributors:
|
|||||||
* Testing.
|
* Testing.
|
||||||
|
|
||||||
Past Contributors:
|
Past Contributors:
|
||||||
|
|
||||||
-- KonoM (Tamir Atias)
|
-- KonoM (Tamir Atias)
|
||||||
* Lazy ass.
|
* Lazy ass.
|
||||||
* Bug Squatter.
|
* Bug Squatter.
|
||||||
|
10
src/log.h
10
src/log.h
@ -1,10 +1,16 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
/* We'll use asserts in DEBUG if defined. */
|
||||||
|
#ifndef DEBUG
|
||||||
|
# define NODEBUG
|
||||||
|
#endif /* DEBUG */
|
||||||
|
#include <assert.h>
|
||||||
|
|
||||||
#define LOG(str, args...)(fprintf(stdout, str"\n", ## args))
|
#define LOG(str, args...)(fprintf(stdout, str"\n", ## args))
|
||||||
#define WARN(str, args...)(fprintf(stderr, "Warning: "str"\n", ## args))
|
#define WARN(str, args...)(fprintf(stderr, "Warning: "str"\n", ## args), assert(0))
|
||||||
#define ERR(str, args...) (fprintf(stderr, "ERROR %s:%d: [%s] "str"\n", \
|
#define ERR(str, args...) (fprintf(stderr, "ERROR %s:%d: [%s] "str"\n", \
|
||||||
__FILE__, __LINE__, __func__, ## args))
|
__FILE__, __LINE__, __func__, ## args), assert(0))
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
# undef DEBUG
|
# undef DEBUG
|
||||||
|
Loading…
Reference in New Issue
Block a user