MCPcopy Create free account
hub / github.com/acl-dev/acl / open_log

Function open_log

lib_acl/src/stdlib/acl_mylog.c:568–607  ·  view source on GitHub ↗

* recipient: * tcp:127.0.0.1:8088 * udp:127.0.0.1:8088 * unix:/var/log/unix.sock * file:/var/log/unix.log * /var/log/unix.log */

Source from the content-addressed store, hash-verified

566 * /var/log/unix.log
567 */
568static int open_log(const char *recipient, const char *logpre)
569{
570 const char *myname = "open_log";
571 const char *ptr;
572
573 if (strncasecmp(recipient, "tcp:", 4) == 0) {
574 ptr = recipient + 4;
575 if (acl_ipv4_addr_valid(ptr) == 0) {
576 printf("%s(%d): recipient(%s) invalid",
577 myname, __LINE__, recipient);
578 return -1;
579 }
580 return open_tcp_log(ptr, logpre);
581 } else if (strncasecmp(recipient, "udp:", 4) == 0) {
582 ptr = recipient + 4;
583 if (acl_ipv4_addr_valid(ptr) == 0) {
584 printf("%s(%d): recipient(%s) invalid",
585 myname, __LINE__, recipient);
586 return -1;
587 }
588 return open_udp_log(ptr, logpre);
589 } else if (strncasecmp(recipient, "unix:", 5) == 0) {
590 ptr = recipient + 5;
591 if (*ptr == 0) {
592 printf("%s(%d): recipient(%s) invalid",
593 myname, __LINE__, recipient);
594 return -1;
595 }
596 return open_unix_log(ptr, logpre);
597 } else if (strncasecmp(recipient, "file:", 5) == 0) {
598 ptr = recipient + 5;
599 if (*ptr == 0) {
600 printf("%s(%d): recipient(%s) invalid",
601 myname, __LINE__, recipient);
602 return -1;
603 }
604 return open_file_log(recipient, logpre);
605 } else
606 return open_file_log(recipient, logpre);
607}
608
609#if defined(ACL_UNIX) && !defined(ACL_ANDROID)
610static void fork_prepare(void)

Callers 1

acl_open_logFunction · 0.85

Calls 6

strncasecmpFunction · 0.85
acl_ipv4_addr_validFunction · 0.85
open_tcp_logFunction · 0.85
open_udp_logFunction · 0.85
open_unix_logFunction · 0.85
open_file_logFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…