Skip to content

Instantly share code, notes, and snippets.

@jybaek
Created May 16, 2016 02:14
Show Gist options
  • Save jybaek/e06dc85a5439b886709f471dcfff7f83 to your computer and use it in GitHub Desktop.
Save jybaek/e06dc85a5439b886709f471dcfff7f83 to your computer and use it in GitHub Desktop.
print debug message in linux system
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