Esempio n. 1
0
SAMPGDK_API(void, sampgdk_logprintf(const char *format, ...)) {
  va_list args;

  va_start(args, format);
  sampgdk_do_vlogprintf(format, args);
  va_end(args);
}
Esempio n. 2
0
File: log.c Progetto: JeeJoy/sampgdk
static void _sampgdk_log_message(int level, const char *format, va_list args) {
  const char *level_string;
  char *real_format;

  assert(level >= _SAMPGDK_LOG_DEBUG &&
         level <= _SAMPGDK_LOG_ERROR);

  if (!_sampgdk_log_enabled[level]) {
    return;
  }

  switch (level) {
    case _SAMPGDK_LOG_DEBUG:
      level_string = "debug";
      break;
    case _SAMPGDK_LOG_INFO:
      level_string = "info";
      break;
    case _SAMPGDK_LOG_WARNING:
      level_string = "warning";
      break;
    case _SAMPGDK_LOG_ERROR:
      level_string = "error";
      break;
    default:
      level_string = "";
  }

  real_format = malloc(
    sizeof("[sampgdk:] ") - 1
    + strlen(level_string)
    + strlen(format)
    + 1
  );
  if (real_format == NULL) {
    return;
  }

  strcpy(real_format, "[sampgdk:");
  strcat(real_format, level_string);
  strcat(real_format, "] ");
  strcat(real_format, format);

  sampgdk_do_vlogprintf(real_format, args);

  free(real_format);
}
Esempio n. 3
0
SAMPGDK_API(void, sampgdk_vlogprintf(const char *format, va_list args)) {
  sampgdk_do_vlogprintf(format, args);
}