Created
May 16, 2016 02:14
-
-
Save jybaek/e06dc85a5439b886709f471dcfff7f83 to your computer and use it in GitHub Desktop.
print debug message in linux system
This file contains hidden or 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
static void printf_msg(const char *fmt, ...) | |
{ | |
if (fmt == NULL) | |
return; | |
va_list ap; | |
#define CMD_SIZE 512 | |
char tmp_buf[CMD_SIZE]; | |
char cmd[CMD_SIZE+128]; | |
memset(tmp_buf, 0x0, sizeof(tmp_buf)); | |
va_start(ap, fmt); | |
vsnprintf(tmp_buf, CMD_SIZE, fmt, ap); | |
va_end(ap); | |
sprintf(cmd, "/usr/bin/logger -i -t app_name '%s'", tmp_buf); | |
system(cmd); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment