src/log.c
/**
 * Messages larger than LOG_MSG_LEN are truncated.
 */
Messages larger than LOG_MSG_LEN are truncated.
Messages larger than LOG_MSG_LEN are truncated .
void log_stream_msg(int prio, const char *fmt, ...)
{
  if (!(LOG_MASK(prio) & log_ctx.fmask))
    return;
  char time[LOG_MSG_PREFIX_LEN] = {0};
  log_time(time);
  char buf[LOG_MSG_LEN] = {0};
  va_list arglist;
  va_start(arglist, fmt);
  int written = snprintf(buf, LOG_MSG_LEN, "%s (%s) [%s] ",
                         time, log_pid, log_level_prefix(prio));
  written += vsnprintf(buf + written, LOG_MSG_LEN - written, fmt, arglist);
  va_end(arglist);
  size_t nl_pos = written < LOG_MSG_LEN ? written : LOG_MSG_LEN - 1;
  buf[nl_pos] = '\n';
  if (mq_send(log_ctx.mqw, buf, LOG_MSG_LEN, 0) < 0)
      perror("mq_send log_mq");
}
void log_stream_msg ( int prio , const char * fmt , ... ) { if ( ! ( LOG_MASK ( prio ) & log_ctx . fmask ) ) return ; char time [ LOG_MSG_PREFIX_LEN ] = { 0 } ; log_time ( time ) ; char buf [ LOG_MSG_LEN ] = { 0 } ; va_list arglist ; va_start ( arglist , fmt ) ; int written = snprintf ( buf , LOG_MSG_LEN , " " , time , log_pid , log_level_prefix ( prio ) ) ; written += vsnprintf ( buf + written , LOG_MSG_LEN - written , fmt , arglist ) ; va_end ( arglist ) ; size_t nl_pos = written < LOG_MSG_LEN ? written : LOG_MSG_LEN - 1 ; buf [ nl_pos ] = ' \n ' ; if ( mq_send ( log_ctx . mqw , buf , LOG_MSG_LEN , 0 ) < 0 ) perror ( " " ) ; }
Messages larger than LOG_MSG_LEN are truncated.
Messages larger than LOG_MSG_LEN are truncated .
/* From vsnprintf(3): a return value of size or more means that the output
     was truncated. */ /* The ending '\0' will be added by the receiving end. */