MCPcopy Create free account
hub / github.com/OpenPrinting/cups / cupsdLogClient

Function cupsdLogClient

scheduler/log.c:500–554  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

498 */
499
500int /* O - 1 on success, 0 on error */
501cupsdLogClient(cupsd_client_t *con, /* I - Client connection */
502 int level, /* I - Log level */
503 const char *message, /* I - Printf-style message string */
504 ...) /* I - Additional arguments as needed */
505{
506 int ret; /* Return value */
507 va_list ap, ap2; /* Argument pointers */
508 char clientmsg[1024]; /* Format string for client message */
509 int status; /* Formatting status */
510
511
512 /*
513 * See if we want to log this message...
514 */
515
516 if (TestConfigFile || !ErrorLog)
517 return (1);
518
519 if (level > LogLevel)
520 return (1);
521
522 /*
523 * Format and write the log message...
524 */
525
526 _cupsMutexLock(&log_mutex);
527
528 if (con)
529 snprintf(clientmsg, sizeof(clientmsg), "[Client %d] %s", con->number,
530 message);
531 else
532 strlcpy(clientmsg, message, sizeof(clientmsg));
533
534 va_start(ap, message);
535
536 do
537 {
538 va_copy(ap2, ap);
539 status = format_log_line(clientmsg, ap2);
540 va_end(ap2);
541 }
542 while (status == 0);
543
544 va_end(ap);
545
546 if (status > 0)
547 ret = cupsdWriteErrorLog(level, log_line);
548 else
549 ret = cupsdWriteErrorLog(CUPSD_LOG_ERROR, "Unable to allocate memory for log line.");
550
551 _cupsMutexUnlock(&log_mutex);
552
553 return (ret);
554}
555
556
557/*

Callers 15

auth.cFile · 0.85
check_admin_accessFunction · 0.85
cupsdAcceptClientFunction · 0.85
cupsdCloseClientFunction · 0.85
cupsdReadClientFunction · 0.85
cupsdSendCommandFunction · 0.85
cupsdSendErrorFunction · 0.85
cupsdSendHeaderFunction · 0.85
cupsdWriteClientFunction · 0.85
check_if_modifiedFunction · 0.85
check_start_tlsFunction · 0.85
get_fileFunction · 0.85

Calls 4

_cupsMutexLockFunction · 0.85
format_log_lineFunction · 0.85
cupsdWriteErrorLogFunction · 0.85
_cupsMutexUnlockFunction · 0.85

Tested by

no test coverage detected