_X_EXPORT void VErrorF(const char *f, va_list args) { #ifdef DDXOSVERRORF if (OsVendorVErrorFProc) OsVendorVErrorFProc(f, args); else LogVWrite(-1, f, args); #else LogVWrite(-1, f, args); #endif }
void LogVHdrMessageVerb(MessageType type, int verb, const char *msg_format, va_list msg_args, const char *hdr_format, va_list hdr_args) { const char *type_str; char tmpFormat[1024]; char *tmpFormat_end = &tmpFormat[sizeof(tmpFormat)]; char *p; int left; type_str = LogMessageTypeVerbString(type, verb); if (!type_str) return; /* if type_str != "", copy it and ' ' to tmpFormat; set p after ' ' */ p = tmpFormat; if (type_str[0] != '\0') p += snprintf(tmpFormat, sizeof(tmpFormat), "%s ", type_str); /* append as much of hdr as fits after type_str (if there was one) */ left = tmpFormat_end - p; if (left > 1) p += vsnprintf(p, left, hdr_format, hdr_args); /* append as much of msg_format as will fit after hdr */ left = tmpFormat_end - p; if (left > 1) snprintf(p, left, "%s", msg_format); LogVWrite(verb, tmpFormat, msg_args); }
_X_EXPORT void xf86MsgVerb(MessageType type, int verb, const char *format, ...) { va_list ap; va_start(ap, format); LogVWrite(verb, format, ap); va_end(ap); }
_X_EXPORT void LogWrite(int verb, const char *f, ...) { va_list args; va_start(args, f); LogVWrite(verb, f, args); va_end(args); }
_X_EXPORT void xf86DrvMsg(int i, MessageType type, const char *format, ...) { va_list ap; va_start(ap, format); LogVWrite(1, format, ap); va_end(ap); }
void xf86ErrorFVerb(int verb, const char *format, ...) { va_list ap; va_start(ap, format); LogVWrite(verb, format, ap); va_end(ap); }
/* Like xf86ErrorFVerb, but with an implied verbose level of 1 */ void xf86ErrorF(const char *format, ...) { va_list ap; va_start(ap, format); if (xf86Verbose >= 1 || xf86LogVerbose >= 1) LogVWrite(1, format, ap); va_end(ap); }
/* Just like ErrorF, but with the verbose level checked */ void xf86ErrorFVerb(int verb, const char *format, ...) { va_list ap; va_start(ap, format); if (xf86Verbose >= verb || xf86LogVerbose >= verb) LogVWrite(verb, format, ap); va_end(ap); }
void LogVMessageVerb(MessageType type, int verb, const char *format, va_list args) { const char *s = X_UNKNOWN_STRING; char tmpBuf[1024]; /* Ignore verbosity for X_ERROR */ if (logVerbosity >= verb || logFileVerbosity >= verb || type == X_ERROR) { switch (type) { case X_PROBED: s = X_PROBE_STRING; break; case X_CONFIG: s = X_CONFIG_STRING; break; case X_DEFAULT: s = X_DEFAULT_STRING; break; case X_CMDLINE: s = X_CMDLINE_STRING; break; case X_NOTICE: s = X_NOTICE_STRING; break; case X_ERROR: s = X_ERROR_STRING; if (verb > 0) verb = 0; break; case X_WARNING: s = X_WARNING_STRING; break; case X_INFO: s = X_INFO_STRING; break; case X_NOT_IMPLEMENTED: s = X_NOT_IMPLEMENTED_STRING; break; case X_UNKNOWN: s = X_UNKNOWN_STRING; break; case X_NONE: s = NULL; break; } /* if s is not NULL we need a space before format */ snprintf(tmpBuf, sizeof(tmpBuf), "%s%s%s", s ? s : "", s ? " " : "", format); LogVWrite(verb, tmpBuf, args); } }
void OsVendorVErrorF(const char *pszFormat, va_list va_args) { #if defined(XWIN_CLIPBOARD) || defined (XWIN_MULTIWINDOW) /* make sure the clipboard and multiwindow threads do not interfere the * main thread */ static pthread_mutex_t s_pmPrinting = PTHREAD_MUTEX_INITIALIZER; /* Lock the printing mutex */ pthread_mutex_lock(&s_pmPrinting); #endif /* Print the error message to a log file, could be stderr */ LogVWrite(0, pszFormat, va_args); #if defined(XWIN_CLIPBOARD) || defined (XWIN_MULTIWINDOW) /* Unlock the printing mutex */ pthread_mutex_unlock(&s_pmPrinting); #endif }
void LogVMessageVerb(MessageType type, int verb, const char *format, va_list args) { const char *type_str; char tmpFormat[1024]; const char *new_format; type_str = LogMessageTypeVerbString(type, verb); if (!type_str) return; /* if type_str is not "", prepend it and ' ', to format */ if (type_str[0] == '\0') new_format = format; else { new_format = tmpFormat; snprintf(tmpFormat, sizeof(tmpFormat), "%s %s", type_str, format); } LogVWrite(verb, new_format, args); }
_X_EXPORT void LogVMessageVerb(MessageType type, int verb, const char *format, va_list args) { const char *s = X_UNKNOWN_STRING; char *tmpBuf = NULL; /* Ignore verbosity for X_ERROR */ if (logVerbosity >= verb || logFileVerbosity >= verb || type == X_ERROR) { switch (type) { case X_PROBED: s = X_PROBE_STRING; break; case X_CONFIG: s = X_CONFIG_STRING; break; case X_DEFAULT: s = X_DEFAULT_STRING; break; case X_CMDLINE: s = X_CMDLINE_STRING; break; case X_NOTICE: s = X_NOTICE_STRING; break; case X_ERROR: s = X_ERROR_STRING; if (verb > 0) verb = 0; break; case X_WARNING: s = X_WARNING_STRING; break; case X_INFO: s = X_INFO_STRING; break; case X_NOT_IMPLEMENTED: s = X_NOT_IMPLEMENTED_STRING; break; case X_UNKNOWN: s = X_UNKNOWN_STRING; break; case X_NONE: s = NULL; break; } /* * Prefix the format string with the message type. We do it this way * so that LogVWrite() is only called once per message. */ if (s) { tmpBuf = malloc(strlen(format) + strlen(s) + 1 + 1); /* Silently return if malloc fails here. */ if (!tmpBuf) return; sprintf(tmpBuf, "%s ", s); strcat(tmpBuf, format); LogVWrite(verb, tmpBuf, args); free(tmpBuf); } else LogVWrite(verb, format, args); } }