-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #109 from AkihiroSuda/dev2
Add log.h
- Loading branch information
Showing
3 changed files
with
38 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef SOCKET_VMNET_LOG_H | ||
#define SOCKET_VMNET_LOG_H | ||
#include <errno.h> | ||
|
||
extern bool debug; | ||
|
||
#define DEBUGF(fmt, ...) \ | ||
do { \ | ||
if (debug) \ | ||
fprintf(stderr, "DEBUG| " fmt "\n", __VA_ARGS__); \ | ||
} while (0) | ||
|
||
#define INFOF(fmt, ...) fprintf(stderr, "INFO | " fmt "\n", __VA_ARGS__) | ||
#define ERROR(msg) fprintf(stderr, "ERROR| " msg "\n") | ||
#define ERRORF(fmt, ...) fprintf(stderr, "ERROR| " fmt "\n", __VA_ARGS__) | ||
#define ERRORN(name) ERRORF(name ": %s", strerror(errno)) | ||
#define WARN(msg) fprintf(stderr, "WARN | " msg "\n") | ||
#define WARNF(fmt, ...) fprintf(stderr, "WARN | " fmt "\n", __VA_ARGS__) | ||
|
||
#endif /* SOCKET_VMNET_LOG_H */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters