static size_t log_header()

in plugin/server_audit/server_audit.cc [1207:1241]


static size_t log_header(char *message, size_t message_len,
                      time_t *ts,
                      const char *serverhost, size_t serverhost_len,
                      const char *username, unsigned int username_len,
                      const char *host, unsigned int host_len,
                      const char *userip, unsigned int userip_len,
                      unsigned int connection_id, long long query_id,
                      const char *operation)
{
  struct tm tm_time;

  if (host_len == 0 && userip_len != 0)
  {
    host_len= userip_len;
    host= userip;
  }

  if (output_type == OUTPUT_SYSLOG)
    return snprintf(message, message_len,
        "%.*s,%.*s,%.*s,%d,%lld,%s",
        (unsigned int) serverhost_len, serverhost,
        username_len, username,
        host_len, host,
        connection_id, query_id, operation);

  (void) localtime_r(ts, &tm_time);
  return snprintf(message, message_len,
      "%04d%02d%02d %02d:%02d:%02d,%.*s,%.*s,%.*s,%d,%lld,%s",
      tm_time.tm_year+1900, tm_time.tm_mon+1, tm_time.tm_mday,
      tm_time.tm_hour, tm_time.tm_min, tm_time.tm_sec,
      (unsigned int) serverhost_len, serverhost,
      username_len, username,
      host_len, host,
      connection_id, query_id, operation);
}