Last active
August 29, 2015 13:56
-
-
Save lethee/9106179 to your computer and use it in GitHub Desktop.
automatically-adding-enter-exit-function-logs-to-a-project
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
// http://stackoverflow.com/questions/2281739/automatically-adding-enter-exit-function-logs-to-a-project | |
#define KNRM "\x1B[0m" | |
#define KRED "\x1B[31m" | |
#define KGRN "\x1B[32m" | |
#define KYEL "\x1B[33m" | |
#define KBLU "\x1B[34m" | |
#define KMAG "\x1B[35m" | |
#define KCYN "\x1B[36m" | |
#define KWHT "\x1B[37m" | |
#define ENTRY EntryRaiiObject obj ## __LINE__ (__FUNCTION__, __LINE__); | |
struct EntryRaiiObject { | |
EntryRaiiObject(const char *f, int line) : f_(f) { printf("%s##>>> %s (%d)%s\n", KGRN, f_, line, KNRM); } | |
~EntryRaiiObject() { printf("%s##<<< %s%s\n", KGRN, f_, KNRM); } | |
const char *f_; | |
}; | |
void main() | |
{ENTRY | |
return; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
pattern: ^{$
replace: {ENTRY
따라서 함수는 반드시 다음행에서 {로 시작해야 한다. struct 등은 다음행에서 {로시작되지 않아야 한다.