
cherokee at cherokee-project
Jun 29, 2009, 11:41 AM
Post #1 of 1
(130 views)
Permalink
|
|
[3403] cherokee/trunk/cherokee: Replace almost all the PRINT_ERROR, PRINT_ERROR_S and PRINT_ERRNO by
|
|
Revision: 3403 http://svn.cherokee-project.com/changeset/3403 Author: alo Date: 2009-06-29 20:41:35 +0200 (Mon, 29 Jun 2009) Log Message: ----------- Replace almost all the PRINT_ERROR, PRINT_ERROR_S and PRINT_ERRNO by their equivalent macro in the new error reporting system. Modified Paths: -------------- cherokee/trunk/cherokee/access.c cherokee/trunk/cherokee/admin_client.c cherokee/trunk/cherokee/avl.c cherokee/trunk/cherokee/balancer.c cherokee/trunk/cherokee/balancer_ip_hash.c cherokee/trunk/cherokee/balancer_round_robin.c cherokee/trunk/cherokee/bind.c cherokee/trunk/cherokee/buffer.c cherokee/trunk/cherokee/common-internal.h cherokee/trunk/cherokee/config_entry.c cherokee/trunk/cherokee/config_reader.c cherokee/trunk/cherokee/connection.c cherokee/trunk/cherokee/cryptor_libssl.c cherokee/trunk/cherokee/downloader.c cherokee/trunk/cherokee/encoder_deflate.c cherokee/trunk/cherokee/encoder_gzip.c cherokee/trunk/cherokee/fdpoll-epoll.c cherokee/trunk/cherokee/fdpoll-kqueue.c cherokee/trunk/cherokee/fdpoll-port.c cherokee/trunk/cherokee/gen_evhost.c cherokee/trunk/cherokee/handler_cgi.c cherokee/trunk/cherokee/handler_custom_error.c cherokee/trunk/cherokee/handler_dbslayer.c cherokee/trunk/cherokee/handler_dirlist.c cherokee/trunk/cherokee/handler_error_redir.c cherokee/trunk/cherokee/handler_fcgi.c cherokee/trunk/cherokee/handler_mirror.c cherokee/trunk/cherokee/handler_proxy.c cherokee/trunk/cherokee/handler_redir.c cherokee/trunk/cherokee/handler_scgi.c cherokee/trunk/cherokee/handler_secdownload.c cherokee/trunk/cherokee/handler_server_info.c cherokee/trunk/cherokee/header.c cherokee/trunk/cherokee/http.c cherokee/trunk/cherokee/icons.c cherokee/trunk/cherokee/init.c cherokee/trunk/cherokee/logger.h cherokee/trunk/cherokee/logger_ncsa.c cherokee/trunk/cherokee/logger_writer.c cherokee/trunk/cherokee/logger_writer.h cherokee/trunk/cherokee/macros.h cherokee/trunk/cherokee/main_tweak.c cherokee/trunk/cherokee/main_worker.c cherokee/trunk/cherokee/ncpus.c cherokee/trunk/cherokee/plugin_loader.c cherokee/trunk/cherokee/post.c cherokee/trunk/cherokee/regex.c cherokee/trunk/cherokee/rule_bind.c cherokee/trunk/cherokee/rule_directory.c cherokee/trunk/cherokee/rule_exists.c cherokee/trunk/cherokee/rule_extensions.c cherokee/trunk/cherokee/rule_from.c cherokee/trunk/cherokee/rule_fullpath.c cherokee/trunk/cherokee/rule_geoip.c cherokee/trunk/cherokee/rule_header.c cherokee/trunk/cherokee/rule_method.c cherokee/trunk/cherokee/rule_request.c cherokee/trunk/cherokee/server.c cherokee/trunk/cherokee/socket.c cherokee/trunk/cherokee/source.c cherokee/trunk/cherokee/source_interpreter.c cherokee/trunk/cherokee/spawner.c cherokee/trunk/cherokee/template.c cherokee/trunk/cherokee/thread.c cherokee/trunk/cherokee/util.c cherokee/trunk/cherokee/util.h cherokee/trunk/cherokee/validator_file.c cherokee/trunk/cherokee/validator_ldap.c cherokee/trunk/cherokee/validator_mysql.c cherokee/trunk/cherokee/virtual_server.c cherokee/trunk/cherokee/vrule_rehost.c cherokee/trunk/cherokee/vrule_wildcard.c Modified: cherokee/trunk/cherokee/access.c =================================================================== --- cherokee/trunk/cherokee/access.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/access.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -197,9 +197,9 @@ # ifdef HAVE_IPV6 if (n->type == ipv6) { if (IN6_IS_ADDR_V4MAPPED (&(n->ip).ip6)) { - PRINT_ERROR ("ERROR: This IP '%s' is IPv6-mapped IPv6 address. " - "Please, specify IPv4 in a.b.c.d style instead " - "of ::ffff:a.b.c.d style\n", ip); + LOG_ERROR ("ERROR: This IP '%s' is IPv6-mapped IPv6 address. " + "Please, specify IPv4 in a.b.c.d style instead " + "of ::ffff:a.b.c.d style\n", ip); return ret_error; } } @@ -312,7 +312,7 @@ ret = parse_ip (ip, n); if (ret < ret_ok) { - PRINT_ERROR ("IP address '%s' seems to be invalid\n", ip); + LOG_ERROR ("IP address '%s' seems to be invalid\n", ip); free_ip(n); return ret; @@ -371,7 +371,7 @@ */ ret = parse_ip (ip.buf, IP_NODE(n)); if (ret < ret_ok) { - PRINT_ERROR ("IP address '%s' seems to be invalid\n", ip.buf); + LOG_ERROR ("IP address '%s' seems to be invalid\n", ip.buf); goto error; } @@ -379,7 +379,7 @@ */ ret = parse_netmask (mask, n); if (ret < ret_ok) { - PRINT_ERROR ("Netmask '%s' seems to be invalid\n", mask); + LOG_ERROR ("Netmask '%s' seems to be invalid\n", mask); goto error; } Modified: cherokee/trunk/cherokee/admin_client.c =================================================================== --- cherokee/trunk/cherokee/admin_client.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/admin_client.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -106,7 +106,7 @@ if ((admin->url_ref == NULL) || (admin->poll_ref == NULL)) { - PRINT_ERROR_S ("ERROR: Internal error\n"); + LOG_CRITICAL_S ("Internal error\n"); return ret_error; } @@ -213,14 +213,14 @@ prepare_and_set_post(admin, str"\n", sizeof(str)) -#define CHECK_AND_SKIP_LITERAL(string, substr) \ - if ((string == NULL) || (strlen(string) == 0)) \ - return ret_error; \ - if (strncmp (string, substr, sizeof(substr)-1)) { \ - PRINT_ERROR ("ERROR: Uknown response len(" FMT_SIZE "): '%s'\n", \ - (CST_SIZE) strlen(string), string); \ - return ret_error; \ - } \ +#define CHECK_AND_SKIP_LITERAL(string, substr) \ + if ((string == NULL) || (strlen(string) == 0)) \ + return ret_error; \ + if (strncmp (string, substr, sizeof(substr)-1)) { \ + LOG_ERROR ("Uknown response len(" FMT_SIZE "): '%s'\n", \ + (CST_SIZE) strlen(string), string); \ + return ret_error; \ + } \ string += sizeof(substr)-1; @@ -236,8 +236,8 @@ re = strncmp (buf->buf, literal, len); if (re != 0) { #if 0 - PRINT_ERROR ("ERROR: Couldn't find len(%d):'%s' in len(%d):'%s'\n", - strlen(literal), literal, buf->len, buf->buf); + LOG_ERROR ("Couldn't find len(%d):'%s' in len(%d):'%s'\n", + strlen(literal), literal, buf->len, buf->buf); #endif return ret_error; } Modified: cherokee/trunk/cherokee/avl.c =================================================================== --- cherokee/trunk/cherokee/avl.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/avl.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -742,7 +742,7 @@ if (node->left_child) { tmp = node_prev (node); if (tmp->right != node) { - PRINT_ERROR_S ("previous"); + LOG_ERROR_S ("previous"); return ret_error; } } @@ -750,7 +750,7 @@ if (node->right_child) { tmp = node_next (node); if (tmp->left != node) { - PRINT_ERROR_S ("next"); + LOG_ERROR_S ("next"); return ret_error; } } @@ -765,7 +765,7 @@ balance = right_height - left_height; if (balance != node->balance) { - PRINT_ERROR_S ("Balance"); + LOG_ERROR_S ("Balance"); return ret_error; } Modified: cherokee/trunk/cherokee/balancer.c =================================================================== --- cherokee/trunk/cherokee/balancer.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/balancer.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -134,7 +134,7 @@ */ ret = cherokee_config_node_get (conf, "source", &subconf); if (ret != ret_ok) { - PRINT_ERROR_S ("ERROR: Balancer: An entry 'source' is needed\n"); + LOG_ERROR_S ("Balancer: An entry 'source' is needed\n"); return ret_error; } @@ -143,7 +143,7 @@ ret = cherokee_avl_get (&srv->sources, &subconf2->val, (void **)&src); if (ret != ret_ok) { - PRINT_ERROR ("Could not find source '%s'\n", subconf2->val.buf); + LOG_ERROR ("Could not find source '%s'\n", subconf2->val.buf); return ret_error; } @@ -217,7 +217,7 @@ cherokee_plugin_info_t *info = NULL; if (cherokee_buffer_is_empty (name)) { - PRINT_ERROR_S ("Balancer defined without a value\n"); + LOG_CRITICAL_S ("Balancer defined without a value\n"); return ret_error; } Modified: cherokee/trunk/cherokee/balancer_ip_hash.c =================================================================== --- cherokee/trunk/cherokee/balancer_ip_hash.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/balancer_ip_hash.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -56,7 +56,7 @@ /* Sanity check */ if (balancer->entries_len <= 0) { - PRINT_ERROR_S ("ERROR: Balancer cannot be empty\n"); + LOG_CRITICAL_S ("Balancer cannot be empty\n"); return ret_error; } @@ -195,7 +195,7 @@ /* Select a back-end */ if (unlikely (balancer->n_active <= 0)) { - PRINT_MSG_S ("ERROR: Sources exhausted: re-enabling one.\n"); + PRINT_MSG_S ("NOTICE: Sources exhausted: re-enabling one.\n"); reactivate_entry (balancer, BAL_ENTRY(balancer->last_one)); balancer->last_one = list_next_circular (&BAL(balancer)->entries, Modified: cherokee/trunk/cherokee/balancer_round_robin.c =================================================================== --- cherokee/trunk/cherokee/balancer_round_robin.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/balancer_round_robin.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -51,7 +51,7 @@ /* Sanity check */ if (balancer->entries_len <= 0) { - PRINT_ERROR_S ("ERROR: Balancer cannot be empty\n"); + LOG_CRITICAL_S ("Balancer cannot be empty\n"); return ret_error; } @@ -119,7 +119,7 @@ /* Count how many it's checked so far */ if (tries > gbal->entries_len) { - PRINT_MSG_S ("ERROR: Sources exhausted: re-enabling one.\n"); + PRINT_MSG_S ("NOTICE: Sources exhausted: re-enabling one.\n"); reactivate_entry (entry); break; } Modified: cherokee/trunk/cherokee/bind.c =================================================================== --- cherokee/trunk/cherokee/bind.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/bind.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -127,7 +127,7 @@ ret = cherokee_config_node_read_int (conf, "port", &listener->port); if (ret != ret_ok) { - PRINT_ERROR_S ("ERROR: A port entry is need."); + LOG_CRITICAL_S ("ERROR: A port entry is need."); return ret_error; } @@ -280,8 +280,8 @@ ret = init_socket (listener, AF_INET); if (ret != ret_ok) { - PRINT_ERROR ("Could not bind() port=%d (UID=%d, GID=%d)\n", - listener->port, getuid(), getgid()); + LOG_CRITICAL ("Could not bind() port=%d (UID=%d, GID=%d)\n", + listener->port, getuid(), getgid()); return ret_error; } } Modified: cherokee/trunk/cherokee/buffer.c =================================================================== --- cherokee/trunk/cherokee/buffer.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/buffer.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -520,7 +520,7 @@ */ estimation = cherokee_estimate_va_length (format, args); if (unlikely (estimation) < 0) { - PRINT_ERROR (" -> '%s', esti=%d ( < 0)\n", format, estimation); + LOG_ERROR (" -> '%s', esti=%d ( < 0)\n", format, estimation); return ret_error; } @@ -528,7 +528,7 @@ */ ret = cherokee_buffer_ensure_size (buf, buf->len + estimation + 2); if (unlikely (ret != ret_ok)) { - PRINT_ERROR (" -> '%s', esti=%d ensure_size=%d failed !\n", format, estimation, buf->len + estimation + 2); + LOG_ERROR (" -> '%s', esti=%d ensure_size=%d failed !\n", format, estimation, buf->len + estimation + 2); return ret; } @@ -537,15 +537,15 @@ */ size = buf->size - buf->len; if (size < 1) { - PRINT_ERROR (" -> '%s', esti=%d size=%d ( < 1)!\n", format, estimation, size); + LOG_ERROR (" -> '%s', esti=%d size=%d ( < 1)!\n", format, estimation, size); return ret_error; } len = vsnprintf (buf->buf + buf->len, size, format, args2); #if 0 if (estimation < len) - PRINT_ERROR (" -> '%s' -> '%s', esti=%d real=%d size=%d\n", - format, buf->buf + buf->len, estimation, len, size); + LOG_ERROR (" -> '%s' -> '%s', esti=%d real=%d size=%d\n", + format, buf->buf + buf->len, estimation, len, size); #endif if (unlikely (len < 0)) @@ -554,8 +554,8 @@ /* At this point buf-size is always greater than buf-len, thus size > 0. */ if (len >= size) { - PRINT_ERROR ("Failed estimation=%d, needed=%d available size=%d: %s\n", - estimation, len, size, format); + LOG_ERROR ("Failed estimation=%d, needed=%d available size=%d: %s\n", + estimation, len, size, format); cherokee_buffer_ensure_size (buf, buf->len + len + 2); size = buf->size - buf->len; @@ -682,8 +682,8 @@ #if 0 if (strlen(buf->buf) != buf->len) { - PRINT_ERROR ("ERROR: cherokee_buffer_move_to_begin(): strlen=%d buf->len=%d\n", - strlen(buf->buf), buf->len); + LOG_ERROR ("ERROR: cherokee_buffer_move_to_begin(): strlen=%d buf->len=%d\n", + strlen(buf->buf), buf->len); } #endif @@ -940,7 +940,7 @@ */ f = open (filename, O_RDONLY | O_BINARY); if (f < 0) { - PRINT_ERRNO(errno, "Couldn't open '%s': ${errno}\n", filename); + LOG_ERRNO(errno, cherokee_err_error, "Couldn't open '%s': ${errno}\n", filename); return ret_error; } @@ -997,7 +997,7 @@ return ret_error; } - PRINT_ERRNO (errno, "read(%d, %u,..): '${errno}'", fd, size); + LOG_ERRNO (errno, cherokee_err_error, "read(%d, %u,..): '${errno}'", fd, size); return ret_error; } else if (len == 0) { Modified: cherokee/trunk/cherokee/common-internal.h =================================================================== --- cherokee/trunk/cherokee/common-internal.h 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/common-internal.h 2009-06-29 18:41:35 UTC (rev 3403) @@ -35,6 +35,7 @@ #include "common.h" #include "threading.h" +#include "error_log.h" #ifndef _WIN32 # if defined HAVE_ENDIAN_H Modified: cherokee/trunk/cherokee/config_entry.c =================================================================== --- cherokee/trunk/cherokee/config_entry.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/config_entry.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -136,7 +136,7 @@ return_if_fail (plugin_info != NULL, ret_error); if (PLUGIN_INFO(plugin_info)->type != cherokee_handler) { - PRINT_ERROR ("Directory '%s' has not a handler module!\n", entry->document_root->buf); + LOG_ERROR ("Directory '%s' has not a handler module!\n", entry->document_root->buf); return ret_error; } Modified: cherokee/trunk/cherokee/config_reader.c =================================================================== --- cherokee/trunk/cherokee/config_reader.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/config_reader.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -62,7 +62,7 @@ re = stat (path->buf, &info); if (re < 0) { - PRINT_MSG ("Could not access '%s'\n", path->buf); + LOG_CRITICAL ("Could not access '%s'\n", path->buf); return ret_error; } @@ -131,8 +131,8 @@ re = cherokee_buffer_case_cmp_buf (&CONFIG_NODE(i)->key, &CONFIG_NODE(j)->key); if (re == 0) { - PRINT_ERROR ("ERROR: '%s' and '%s' as child of the same node.\n", - CONFIG_NODE(i)->key.buf, CONFIG_NODE(j)->key.buf); + LOG_ERROR ("'%s' and '%s' as child of the same node.\n", + CONFIG_NODE(i)->key.buf, CONFIG_NODE(j)->key.buf); return ret_error; } } @@ -246,7 +246,7 @@ return ret_ok; error: - PRINT_MSG ("Error parsing: %s\n", begin); + LOG_ERROR ("Error parsing: %s\n", begin); cherokee_buffer_mrproper (&key); cherokee_buffer_mrproper (&val); Modified: cherokee/trunk/cherokee/connection.c =================================================================== --- cherokee/trunk/cherokee/connection.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/connection.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -1481,7 +1481,7 @@ break; default: - PRINT_ERROR_S ("Unknown authentication method\n"); + LOG_ERROR_S ("Unknown authentication method\n"); return ret_error; } @@ -1562,7 +1562,7 @@ return ret_ok; error: - PRINT_ERROR_S ("Couldn't set local directory\n"); + LOG_ERROR_S ("Couldn't set local directory\n"); return ret_error; } @@ -1908,7 +1908,7 @@ ret = cherokee_server_get_vserver (CONN_SRV(conn), &conn->host, (cherokee_virtual_server_t **)&conn->vserver); if (unlikely (ret != ret_ok)) { - PRINT_ERROR ("Couldn't get virtual server: '%s'\n", conn->host.buf); + LOG_ERROR ("Couldn't get virtual server: '%s'\n", conn->host.buf); return ret_error; } break; Modified: cherokee/trunk/cherokee/cryptor_libssl.c =================================================================== --- cherokee/trunk/cherokee/cryptor_libssl.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/cryptor_libssl.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -183,7 +183,7 @@ */ socket = SSL_get_app_data (ssl); if (unlikely (socket == NULL)) { - PRINT_ERROR ("Could not get the socket struct: %p\n", ssl); + LOG_ERROR ("Could not get the socket struct: %p\n", ssl); return SSL_TLSEXT_ERR_ALERT_FATAL; } @@ -203,7 +203,7 @@ ret = cherokee_server_get_vserver (srv, &tmp, &vsrv); if ((ret != ret_ok) || (vsrv == NULL)) { - PRINT_ERROR ("Servername did not match: '%s'\n", servername); + LOG_ERROR ("Servername did not match: '%s'\n", servername); return SSL_TLSEXT_ERR_NOACK; } @@ -214,7 +214,7 @@ */ ctx = SSL_set_SSL_CTX (ssl, CRYPTOR_VSRV_SSL(vsrv->cryptor)->context); if (ctx != CRYPTOR_VSRV_SSL(vsrv->cryptor)->context) { - PRINT_ERROR ("Could change the SSL context: servername='%s'\n", servername); + LOG_ERROR ("Could change the SSL context: servername='%s'\n", servername); } /* SSL_set_SSL_CTX() only change certificates. We need to @@ -281,7 +281,7 @@ */ n->context = SSL_CTX_new (SSLv23_server_method()); if (n->context == NULL) { - PRINT_ERROR_S("ERROR: OpenSSL: Couldn't allocate OpenSSL context\n"); + LOG_ERROR_S("OpenSSL: Couldn't allocate OpenSSL context\n"); return ret_error; } @@ -307,8 +307,8 @@ rc = SSL_CTX_set_cipher_list (n->context, vsrv->ciphers.buf); if (rc != 1) { OPENSSL_LAST_ERROR(error); - PRINT_ERROR("ERROR: OpenSSL: Can not set cipher list '%s': %s\n", - vsrv->ciphers.buf, error); + LOG_ERROR("OpenSSL: Can not set cipher list '%s': %s\n", + vsrv->ciphers.buf, error); return ret_error; } } @@ -323,8 +323,8 @@ rc = SSL_CTX_use_certificate_chain_file (n->context, vsrv->server_cert.buf); if (rc != 1) { OPENSSL_LAST_ERROR(error); - PRINT_ERROR("ERROR: OpenSSL: Can not use certificate file '%s': %s\n", - vsrv->server_cert.buf, error); + LOG_ERROR("OpenSSL: Can not use certificate file '%s': %s\n", + vsrv->server_cert.buf, error); return ret_error; } @@ -333,8 +333,8 @@ rc = SSL_CTX_use_PrivateKey_file (n->context, vsrv->server_key.buf, SSL_FILETYPE_PEM); if (rc != 1) { OPENSSL_LAST_ERROR(error); - PRINT_ERROR("ERROR: OpenSSL: Can not use private key file '%s': %s\n", - vsrv->server_key.buf, error); + LOG_ERROR("OpenSSL: Can not use private key file '%s': %s\n", + vsrv->server_key.buf, error); return ret_error; } @@ -342,7 +342,7 @@ */ rc = SSL_CTX_check_private_key (n->context); if (rc != 1) { - PRINT_ERROR_S("ERROR: OpenSSL: Private key does not match the certificate public key\n"); + LOG_ERROR_S("OpenSSL: Private key does not match the certificate public key\n"); return ret_error; } @@ -360,16 +360,16 @@ rc = SSL_CTX_load_verify_locations (n->context, vsrv->certs_ca.buf, NULL); if (rc != 1) { OPENSSL_LAST_ERROR(error); - PRINT_ERROR("ERROR: OpenSSL: Can't read trusted CA list '%s': %s\n", - vsrv->certs_ca.buf, error); + LOG_CRITICAL("OpenSSL: Can't read trusted CA list '%s': %s\n", + vsrv->certs_ca.buf, error); return ret_error; } X509_clients = SSL_load_client_CA_file (vsrv->certs_ca.buf); if (X509_clients == NULL) { OPENSSL_LAST_ERROR(error); - PRINT_ERROR ("SSL_load_client_CA_file '%s': %s\n", - vsrv->certs_ca.buf, error); + LOG_CRITICAL ("SSL_load_client_CA_file '%s': %s\n", + vsrv->certs_ca.buf, error); return ret_error; } @@ -391,8 +391,8 @@ vsrv->name.buf, vsrv->name.len); if (rc != 1) { OPENSSL_LAST_ERROR(error); - PRINT_ERROR ("Unable to set SSL session-id context for '%s': %s\n", - vsrv->name.buf, error); + LOG_ERROR ("Unable to set SSL session-id context for '%s': %s\n", + vsrv->name.buf, error); } SSL_CTX_set_mode (n->context, SSL_MODE_ENABLE_PARTIAL_WRITE); @@ -403,14 +403,14 @@ rc = SSL_CTX_set_tlsext_servername_callback (n->context, openssl_sni_servername_cb); if (rc != 1) { OPENSSL_LAST_ERROR(error); - PRINT_ERROR ("Could activate TLS SNI for '%s': %s\n", vsrv->name.buf, error); + LOG_ERROR ("Could activate TLS SNI for '%s': %s\n", vsrv->name.buf, error); return ret_error; } rc = SSL_CTX_set_tlsext_servername_arg (n->context, VSERVER_SRV(vsrv)); if (rc != 1) { OPENSSL_LAST_ERROR(error); - PRINT_ERROR ("Could activate TLS SNI for '%s': %s\n", vsrv->name.buf, error); + LOG_ERROR ("Could activate TLS SNI for '%s': %s\n", vsrv->name.buf, error); return ret_error; } #endif /* OPENSSL_NO_TLSEXT */ @@ -449,8 +449,8 @@ cryp->session = SSL_new (vsrv_crytor->context); if (cryp->session == NULL) { OPENSSL_LAST_ERROR(error); - PRINT_ERROR ("ERROR: OpenSSL: Unable to create a new SSL " - "connection from the SSL context: %s\n", error); + LOG_ERROR ("OpenSSL: Unable to create a new SSL " + "connection from the SSL context: %s\n", error); return ret_error; } @@ -459,8 +459,8 @@ re = SSL_set_fd (cryp->session, socket->socket); if (re != 1) { OPENSSL_LAST_ERROR(error); - PRINT_ERROR ("ERROR: OpenSSL: Can not set fd(%d): %s\n", - socket->socket, error); + LOG_ERROR ("OpenSSL: Can not set fd(%d): %s\n", + socket->socket, error); return ret_error; } @@ -510,7 +510,7 @@ return ret_error; default: OPENSSL_LAST_ERROR(error); - PRINT_ERROR ("ERROR: Init OpenSSL: %s\n", error); + LOG_ERROR ("Init OpenSSL: %s\n", error); return ret_error; } } @@ -572,7 +572,8 @@ case ECONNRESET: return ret_eof; default: - PRINT_ERRNO_S (error, "SSL_write: unknown errno: ${errno}\n"); + LOG_ERRNO_S (error, cherokee_err_error, + "SSL_write: unknown errno: ${errno}\n"); } return ret_error; @@ -580,8 +581,8 @@ return ret_error; } - PRINT_ERROR ("ERROR: SSL_write (%d, ..) -> err=%d '%s'\n", - SSL_get_fd(cryp->session), (int)len, ERR_error_string(re, NULL)); + LOG_ERROR ("SSL_write (%d, ..) -> err=%d '%s'\n", + SSL_get_fd(cryp->session), (int)len, ERR_error_string(re, NULL)); return ret_error; } @@ -628,13 +629,14 @@ case ECONNRESET: return ret_eof; default: - PRINT_ERRNO_S (error, "SSL_read: unknown errno: ${errno}\n"); + LOG_ERRNO_S (error, cherokee_err_error, + "SSL_read: unknown errno: ${errno}\n"); } return ret_error; } - PRINT_ERROR ("ERROR: OpenSSL: SSL_read (%d, ..) -> err=%d '%s'\n", - SSL_get_fd(cryp->session), (int)len, ERR_error_string(re, NULL)); + LOG_ERROR ("OpenSSL: SSL_read (%d, ..) -> err=%d '%s'\n", + SSL_get_fd(cryp->session), (int)len, ERR_error_string(re, NULL)); return ret_error; } @@ -709,7 +711,7 @@ cryp->ssl_ctx = SSL_CTX_new (SSLv23_client_method()); if (cryp->ssl_ctx == NULL) { OPENSSL_LAST_ERROR(error); - PRINT_ERROR ("ERROR: OpenSSL: Unable to create a new SSL context: %s\n", error); + LOG_CRITICAL ("OpenSSL: Unable to create a new SSL context: %s\n", error); return ret_error; } @@ -720,22 +722,21 @@ socket->vserver_ref->certs_ca.buf, NULL); if (! re) { OPENSSL_LAST_ERROR(error); - PRINT_ERROR ("ERROR: OpenSSL: '%s': %s\n", - socket->vserver_ref->certs_ca.buf, error); + LOG_ERROR ("OpenSSL: '%s': %s\n", + socket->vserver_ref->certs_ca.buf, error); return ret_error; } re = SSL_CTX_set_default_verify_paths (socket->ssl_ctx); if (! re) { OPENSSL_LAST_ERROR(error); - PRINT_ERROR ("ERROR: OpenSSL: cannot set certificate " - "verification paths: %s\n", error); + LOG_ERROR ("OpenSSL: cannot set certificate " + "verification paths: %s\n", error); return ret_error; } } */ - SSL_CTX_set_verify (cryp->ssl_ctx, SSL_VERIFY_NONE, NULL); SSL_CTX_set_mode (cryp->ssl_ctx, SSL_MODE_ENABLE_PARTIAL_WRITE); @@ -744,8 +745,8 @@ cryp->session = SSL_new (cryp->ssl_ctx); if (cryp->session == NULL) { OPENSSL_LAST_ERROR(error); - PRINT_ERROR ("ERROR: OpenSSL: Unable to create a new SSL connection " - "from the SSL context: %s\n", error); + LOG_ERROR ("OpenSSL: Unable to create a new SSL connection " + "from the SSL context: %s\n", error); return ret_error; } @@ -754,7 +755,7 @@ re = SSL_set_fd (cryp->session, socket->socket); if (re != 1) { OPENSSL_LAST_ERROR(error); - PRINT_ERROR ("ERROR: OpenSSL: Can not set fd(%d): %s\n", socket->socket, error); + LOG_ERROR ("OpenSSL: Can not set fd(%d): %s\n", socket->socket, error); return ret_error; } @@ -767,7 +768,7 @@ re = SSL_set_tlsext_host_name (cryp->session, host->buf); if (re <= 0) { OPENSSL_LAST_ERROR(error); - PRINT_ERROR ("ERROR: OpenSSL: Could set SNI server name: %s\n", error); + LOG_ERROR ("OpenSSL: Could set SNI server name: %s\n", error); return ret_error; } } @@ -776,7 +777,7 @@ re = SSL_connect (cryp->session); if (re <= 0) { OPENSSL_LAST_ERROR(error); - PRINT_ERROR ("ERROR: OpenSSL: Can not connect: %s\n", error); + LOG_ERROR ("OpenSSL: Can not connect: %s\n", error); return ret_error; } @@ -893,13 +894,13 @@ while (e != NULL) { if(! ENGINE_init(e)) { ENGINE_free (e); - PRINT_ERROR_S ("ERROR: Could not init pkcs11 engine"); + LOG_CRITICAL_S ("Could not init pkcs11 engine"); break; } if(! ENGINE_set_default(e, ENGINE_METHOD_ALL)) { ENGINE_free (e); - PRINT_ERROR_S ("ERROR: Could not set all defaults"); + LOG_CRITICAL_S ("Could not set all defaults"); break; } Modified: cherokee/trunk/cherokee/downloader.c =================================================================== --- cherokee/trunk/cherokee/downloader.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/downloader.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -402,7 +402,7 @@ return ret_error; default: - PRINT_ERROR ("Unknown ret code %d\n", ret); + LOG_ERROR ("Unknown ret code %d\n", ret); SHOULDNT_HAPPEN; return ret; } @@ -583,7 +583,7 @@ TRACE(ENTRIES, "post=%p\n", post); if (downloader->post != NULL) { - PRINT_ERROR_S ("WARNING: Overwriting post info\n"); + LOG_WARNING_S ("Overwriting post info\n"); } downloader->post = post; Modified: cherokee/trunk/cherokee/encoder_deflate.c =================================================================== --- cherokee/trunk/cherokee/encoder_deflate.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/encoder_deflate.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -26,6 +26,7 @@ #include "encoder_deflate.h" #include "plugin_loader.h" + /* Plug-in initialization */ PLUGIN_INFO_ENCODER_EASIEST_INIT (deflate); @@ -130,8 +131,8 @@ Z_DEFAULT_STRATEGY); if (err != Z_OK) { - PRINT_ERROR("Error in deflateInit2() = %s\n", - get_deflate_error_string(err)); + LOG_ERROR("deflateInit2() = %s\n", + get_deflate_error_string(err)); return ret_error; } @@ -180,16 +181,15 @@ case Z_STREAM_END: err = zlib_deflateEnd (z); if (err != Z_OK) { - PRINT_ERROR("Error in deflateEnd(): err=%s\n", - get_deflate_error_string(err)); + LOG_ERROR("deflateEnd(): err=%s\n", + get_deflate_error_string(err)); return ret_error; } cherokee_buffer_add (out, buf, sizeof(buf) - z->avail_out); break; default: - PRINT_ERROR("Error in deflate(): err=%s avail=%d\n", - get_deflate_error_string(err), - z->avail_in); + LOG_ERROR("deflate(): err=%s avail=%d\n", + get_deflate_error_string(err), z->avail_in); zlib_deflateEnd (z); return ret_error; Modified: cherokee/trunk/cherokee/encoder_gzip.c =================================================================== --- cherokee/trunk/cherokee/encoder_gzip.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/encoder_gzip.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -28,6 +28,7 @@ #include "encoder_gzip.h" #include "plugin_loader.h" + /* Plug-in initialization */ PLUGIN_INFO_ENCODER_EASIEST_INIT (gzip); @@ -170,8 +171,8 @@ Z_DEFAULT_STRATEGY); if (err != Z_OK) { - PRINT_ERROR("Error in deflateInit2() = %s\n", - get_gzip_error_string(err)); + LOG_ERROR("Error in deflateInit2() = %s\n", + get_gzip_error_string(err)); return ret_error; } @@ -250,17 +251,16 @@ case Z_STREAM_END: err = zlib_deflateEnd (z); if (err != Z_OK) { - PRINT_ERROR("Error in deflateEnd(): err=%s\n", - get_gzip_error_string(err)); + LOG_ERROR("deflateEnd(): err=%s\n", + get_gzip_error_string(err)); return ret_error; } cherokee_buffer_add (out, buf, sizeof(buf) - z->avail_out); break; default: - PRINT_ERROR("Error in deflate(): err='%s' avail=%d\n", - get_gzip_error_string(err), - z->avail_in); + LOG_ERROR("deflate(): err='%s' avail=%d\n", + get_gzip_error_string(err), z->avail_in); zlib_deflateEnd (z); return ret_error; Modified: cherokee/trunk/cherokee/fdpoll-epoll.c =================================================================== --- cherokee/trunk/cherokee/fdpoll-epoll.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/fdpoll-epoll.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -109,7 +109,8 @@ } if (epoll_ctl (fdp->ep_fd, EPOLL_CTL_ADD, fd, &ev) < 0) { - PRINT_ERRNO (errno, "epoll_ctl(%d, EPOLL_CTL_ADD, %d): '${errno}'", fdp->ep_fd, fd); + LOG_ERRNO (errno, cherokee_err_error, + "epoll_ctl(%d, EPOLL_CTL_ADD, %d): '${errno}'", fdp->ep_fd, fd); return ret_error; } @@ -135,7 +136,8 @@ } if (epoll_ctl(fdp->ep_fd, EPOLL_CTL_DEL, fd, &ev) < 0) { - PRINT_ERRNO (errno, "epoll_ctl(%d, EPOLL_CTL_DEL, %d): '${errno}'", fdp->ep_fd, fd); + LOG_ERRNO (errno, cherokee_err_error, + "epoll_ctl(%d, EPOLL_CTL_DEL, %d): '${errno}'", fdp->ep_fd, fd); return ret_error; } @@ -225,7 +227,8 @@ } if (epoll_ctl(fdp->ep_fd, EPOLL_CTL_MOD, fd, &ev) < 0) { - PRINT_ERRNO (errno, "epoll_ctl(%d, EPOLL_CTL_MOD, %d): '${errno}'", fdp->ep_fd, fd); + LOG_ERRNO (errno, cherokee_err_error, + "epoll_ctl(%d, EPOLL_CTL_MOD, %d): '${errno}'", fdp->ep_fd, fd); return ret_error; } return ret_ok; @@ -309,7 +312,8 @@ * but the kernel doesn't. */ #if 0 - PRINT_ERRNO (errno, "epoll_create(%d): '${errno}'", nfd->nfiles+1); + LOG_ERRNO (errno, cherokee_err_error, + "epoll_create(%d): '${errno}'", nfd->nfiles+1); #endif _free (n); return ret_error; @@ -317,7 +321,8 @@ re = fcntl (n->ep_fd, F_SETFD, FD_CLOEXEC); if (re < 0) { - PRINT_ERRNO (errno, "Could not set CloseExec to the epoll descriptor: fcntl: '${errno}'"); + LOG_ERRNO (errno, cherokee_err_error, + "Could not set CloseExec to the epoll descriptor: fcntl: '${errno}'"); _free (n); return ret_error; } Modified: cherokee/trunk/cherokee/fdpoll-kqueue.c =================================================================== --- cherokee/trunk/cherokee/fdpoll-kqueue.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/fdpoll-kqueue.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -173,7 +173,7 @@ &timeout); fdp->nchanges=0; if (unlikely (n_events < 0)) { - PRINT_ERRNO (errno, "kevent: '${errno}'"); + LOG_ERRNO (errno, cherokee_err_error, "kevent: '${errno}'"); return 0; } else if (n_events > 0) { Modified: cherokee/trunk/cherokee/fdpoll-port.c =================================================================== --- cherokee/trunk/cherokee/fdpoll-port.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/fdpoll-port.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -81,7 +81,7 @@ rw); /* user data */ if ( rc == -1 ) { - PRINT_ERRNO (errno, "port_associate: fd %d: '${errno}'", fd); + LOG_ERRNO (errno, cherokee_err_error, "port_associate: fd %d: '${errno}'", fd); return ret_error; } @@ -119,7 +119,7 @@ rc = fd_associate(fdp, fd, (rw == FDPOLL_MODE_WRITE ? WRITE : READ)); if ( rc == -1 ) { - PRINT_ERRNO (errno, "port_associate: fd %d: '${errno}'", fd); + LOG_ERRNO (errno, cherokee_err_error, "port_associate: fd %d: '${errno}'", fd); return ret_error; } @@ -137,7 +137,7 @@ PORT_SOURCE_FD, /* source */ fd); /* object */ if ( rc == -1 ) { - PRINT_ERRNO (errno, "port_dissociate: fd %d: '${errno}'", fd); + LOG_ERRNO (errno, cherokee_err_error, "port_dissociate: fd %d: '${errno}'", fd); return ret_error; } @@ -170,7 +170,7 @@ (uint_t *)&fdp->port_readyfds, &timeout); if ( rc < 0 ) { - PRINT_ERRNO_S (errno, "port_getn: '${errno}'"); + LOG_ERRNO_S (errno, cherokee_err_error, "port_getn: '${errno}'"); return 0; } @@ -186,7 +186,7 @@ rc = port_getn (fdp->port, fdp->port_events,FDPOLL(fdp)->nfiles, &fdp->port_readyfds, &timeout); if ( ( (rc < 0) && (errno != ETIME) ) || (fdp->port_readyfds == -1)) { - PRINT_ERRNO_S (errno, "port_getn: '${errno}'"); + LOG_ERRNO_S (errno, cherokee_err_error, "port_getn: '${errno}'"); return 0; } @@ -199,7 +199,7 @@ nfd, fdp->port_events[i].portev_user); if ( rc < 0 ) { - PRINT_ERRNO_S (errno, "port_associate: '${errno}'"); + LOG_ERRNO_S (errno, cherokee_err_error, "port_associate: '${errno}'"); } } @@ -253,7 +253,7 @@ (rw == FDPOLL_MODE_WRITE ? POLLOUT : POLLIN), (rw == FDPOLL_MODE_WRITE ? WRITE : READ)); if ( rc == -1 ) { - PRINT_ERRNO (errno, "port_associate: fd %d: '${errno}'", fd); + LOG_ERRNO (errno, cherokee_err_error, "port_associate: fd %d: '${errno}'", fd); return ret_error; } Modified: cherokee/trunk/cherokee/gen_evhost.c =================================================================== --- cherokee/trunk/cherokee/gen_evhost.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/gen_evhost.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -117,13 +117,13 @@ ret = cherokee_config_node_read (config, "tpl_document_root", &tmp); if (ret != ret_ok) { - PRINT_ERROR_S ("ERROR: EvHost needs a 'tpl_document_root property'\n"); + LOG_CRITICAL_S ("ERROR: EvHost needs a 'tpl_document_root property'\n"); return ret; } ret = cherokee_template_parse (&evhost->tpl_document_root, tmp); if (ret != ret_ok) { - PRINT_ERROR ("ERROR: EvHost: Couldn't parse template '%s'\n", tmp->buf); + LOG_CRITICAL ("ERROR: EvHost: Couldn't parse template '%s'\n", tmp->buf); return ret_error; } Modified: cherokee/trunk/cherokee/handler_cgi.c =================================================================== --- cherokee/trunk/cherokee/handler_cgi.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/handler_cgi.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -492,7 +492,7 @@ flags &= ~remove_flags; if (fcntl (fd, F_SETFL, flags) == -1) { - PRINT_ERRNO (errno, "Setting pipe properties fd=%d: '${errno}'", fd); + LOG_ERRNO (errno, cherokee_err_error, "Setting pipe properties fd=%d: '${errno}'", fd); return ret_error; } @@ -651,9 +651,8 @@ /* Don't use the logging system (concurrency issues) */ - PRINT_ERROR ("Couldn't execute '%s': %s\n", - absolute_path, - cherokee_strerror_r(err, buferr, sizeof(buferr))); + LOG_ERROR ("Couldn't execute '%s': %s\n", + absolute_path, cherokee_strerror_r(err, buferr, sizeof(buferr))); exit(1); } @@ -833,7 +832,7 @@ CloseHandle (hChildStdoutWr); if (!re) { - PRINT_ERROR ("CreateProcess error: error=%d\n", GetLastError()); + LOG_ERROR ("CreateProcess error: error=%d\n", GetLastError()); CloseHandle (pi.hProcess); CloseHandle (pi.hThread); Modified: cherokee/trunk/cherokee/handler_custom_error.c =================================================================== --- cherokee/trunk/cherokee/handler_custom_error.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/handler_custom_error.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -69,7 +69,7 @@ /* Post checks */ if (props->error_code == http_unset) { - PRINT_ERROR_S ("Handler custom error needs an HTTP error value.\n"); + LOG_CRITICAL_S ("Handler custom error needs an HTTP error value.\n"); return ret_error; } Modified: cherokee/trunk/cherokee/handler_dbslayer.c =================================================================== --- cherokee/trunk/cherokee/handler_dbslayer.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/handler_dbslayer.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -554,8 +554,7 @@ props->lang = dwriter_ruby; } else { - PRINT_ERROR ("ERROR: DBSlayer: unrecognized language '%s'\n", - subconf->val.buf); + LOG_CRITICAL ("DBSlayer: unrecognized language '%s'\n", subconf->val.buf); return ret_error; } } @@ -564,7 +563,7 @@ /* Final checks */ if (props->balancer == NULL) { - PRINT_ERROR_S ("ERROR: DBSlayer handler needs a balancer\n"); + LOG_CRITICAL_S ("DBSlayer handler needs a balancer\n"); return ret_error; } Modified: cherokee/trunk/cherokee/handler_dirlist.c =================================================================== --- cherokee/trunk/cherokee/handler_dirlist.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/handler_dirlist.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -271,7 +271,7 @@ ret = load_theme (&theme_path, props); if (ret != ret_ok) { - PRINT_MSG ("Couldn't load theme '%s': %s\n", theme, theme_path.buf); + LOG_ERROR ("Couldn't load theme '%s': %s\n", theme, theme_path.buf); } cherokee_buffer_mrproper (&theme_path); return ret; @@ -446,7 +446,7 @@ if (cherokee_buffer_is_empty (&HDL_DIRLIST_PROP(n)->entry) || cherokee_buffer_is_empty (&HDL_DIRLIST_PROP(n)->header) || cherokee_buffer_is_empty (&HDL_DIRLIST_PROP(n)->footer)) { - PRINT_ERROR_S ("The theme is incomplete\n"); + LOG_CRITICAL_S ("The theme is incomplete\n"); return ret_error; } Modified: cherokee/trunk/cherokee/handler_error_redir.c =================================================================== --- cherokee/trunk/cherokee/handler_error_redir.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/handler_error_redir.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -88,7 +88,7 @@ if (!http_type_300 (error) && !http_type_400 (error) && !http_type_500 (error)) { - PRINT_ERROR ("ERROR: error_redir: Wrong error code: '%s'\n", subconf->key.buf); + LOG_ERROR ("error_redir: Wrong error code: '%s'\n", subconf->key.buf); continue; } @@ -108,7 +108,7 @@ */ ret = cherokee_config_node_copy (subconf, "url", &entry->url); if (ret != ret_ok) { - PRINT_ERROR ("Redir Error %d: An 'url' property is required\n", error); + LOG_CRITICAL ("Redir Error %d: An 'url' property is required\n", error); return ret_error; } Modified: cherokee/trunk/cherokee/handler_fcgi.c =================================================================== --- cherokee/trunk/cherokee/handler_fcgi.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/handler_fcgi.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -81,7 +81,7 @@ if (header->version != 1) { cherokee_buffer_print_debug (inbuf, -1); - PRINT_ERROR_S ("Parsing error: unknown version\n"); + LOG_ERROR_S ("Parsing error: unknown version\n"); return ret_error; } @@ -89,7 +89,7 @@ header->type != FCGI_STDOUT && header->type != FCGI_END_REQUEST) { cherokee_buffer_print_debug (inbuf, -1); - PRINT_ERROR_S ("Parsing error: unknown type\n"); + LOG_ERROR_S ("Parsing error: unknown type\n"); return ret_error; } @@ -259,7 +259,7 @@ /* Final checks */ if (props->balancer == NULL) { - PRINT_ERROR_S ("ERROR: fcgi handler needs a balancer\n"); + LOG_CRITICAL_S ("fcgi handler needs a balancer\n"); return ret_error; } Modified: cherokee/trunk/cherokee/handler_mirror.c =================================================================== --- cherokee/trunk/cherokee/handler_mirror.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/handler_mirror.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -84,7 +84,7 @@ /* Final checks */ if (props->balancer == NULL) { - PRINT_ERROR_S ("ERROR: Mirror handler needs a balancer\n"); + LOG_CRITICAL_S ("ERROR: Mirror handler needs a balancer\n"); return ret_error; } Modified: cherokee/trunk/cherokee/handler_proxy.c =================================================================== --- cherokee/trunk/cherokee/handler_proxy.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/handler_proxy.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -212,7 +212,7 @@ /* Final checks */ if (props->balancer == NULL) { - PRINT_ERROR_S ("ERROR: Proxy handler needs a balancer\n"); + LOG_CRITICAL_S ("Proxy handler needs a balancer\n"); return ret_error; } @@ -237,7 +237,7 @@ in_buf->buf, in_buf->len, 0, 0, ovector, OVECTOR_LEN); if (re == 0) { - PRINT_ERROR_S("Too many groups in the regex\n"); + LOG_ERROR_S("Too many groups in the regex\n"); } if (re <= 0) { continue; Modified: cherokee/trunk/cherokee/handler_redir.c =================================================================== --- cherokee/trunk/cherokee/handler_redir.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/handler_redir.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -111,7 +111,7 @@ else { rc = pcre_exec (list->re, NULL, subject, subject_len, 0, 0, ovector, OVECTOR_LEN); if (rc == 0) { - PRINT_ERROR_S("Too many groups in the regex\n"); + LOG_ERROR_S("Too many groups in the regex\n"); } TRACE (ENTRIES, "subject = \"%s\" + len(\"%s\")-1=%d\n", Modified: cherokee/trunk/cherokee/handler_scgi.c =================================================================== --- cherokee/trunk/cherokee/handler_scgi.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/handler_scgi.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -97,7 +97,7 @@ /* Final checks */ if (props->balancer == NULL) { - PRINT_ERROR_S ("ERROR: SCGI handler needs a balancer\n"); + LOG_CRITICAL_S ("ERROR: SCGI handler needs a balancer\n"); return ret_error; } Modified: cherokee/trunk/cherokee/handler_secdownload.c =================================================================== --- cherokee/trunk/cherokee/handler_secdownload.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/handler_secdownload.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -75,7 +75,7 @@ */ ret = cherokee_config_node_copy (conf, "secret", &props->secret); if (ret != ret_ok) { - PRINT_ERROR_S ("ERROR: Handler secdownload needs a secret.\n"); + LOG_CRITICAL_S ("Handler secdownload needs a secret.\n"); return ret_error; } Modified: cherokee/trunk/cherokee/handler_server_info.c =================================================================== --- cherokee/trunk/cherokee/handler_server_info.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/handler_server_info.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -289,7 +289,7 @@ props->connection_details = true; } else { - PRINT_ERROR("Unknown ServerInfo type: '%s'\n", subconf->val.buf); + LOG_ERROR("Unknown ServerInfo type: '%s'\n", subconf->val.buf); return ret_error; } } @@ -499,7 +499,7 @@ } else if (mod->type & cherokee_vrule) { *vrules += 1; } else { - PRINT_ERROR("Unknown module type (%d)\n", mod->type); + LOG_ERROR("Unknown module type (%d)\n", mod->type); } return 0; Modified: cherokee/trunk/cherokee/header.c =================================================================== --- cherokee/trunk/cherokee/header.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/header.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -818,7 +818,7 @@ /* Check the buffer content */ if ((buffer->buf == NULL) || (buffer->len < 5)) { - PRINT_ERROR_S ("ERROR: Calling cherokee_header_parse() with an empty header\n"); + LOG_ERROR_S ("Calling cherokee_header_parse() with an empty header\n"); return ret_error; } @@ -839,9 +839,9 @@ ret = has_header_request (hdr, buffer, buffer->len); if (ret != ret_ok) { if (ret == ret_not_found) - PRINT_ERROR("ERROR: EOH not found:\n===\n%s===\n", buffer->buf); + LOG_ERROR("EOH not found:\n===\n%s===\n", buffer->buf); else - PRINT_ERROR("ERROR: Too many initial CRLF:\n===\n%s===\n", buffer->buf); + LOG_ERROR("Too many initial CRLF:\n===\n%s===\n", buffer->buf); return ret_error; } } @@ -1049,7 +1049,7 @@ } if (ret < ret_ok) { - PRINT_ERROR_S ("ERROR: Failed to add_(un)known_header()\n"); + LOG_ERROR_S ("Failed to add_(un)known_header()\n"); *header_end = chr_header_end; return ret; } Modified: cherokee/trunk/cherokee/http.c =================================================================== --- cherokee/trunk/cherokee/http.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/http.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -260,7 +260,7 @@ entry_code (switching_protocols); default: - PRINT_ERROR ("ERROR: Unknown HTTP status code %d\n", code); + LOG_WARNING ("Unknown HTTP status code %d\n", code); cherokee_buffer_add_str (buf, http_internal_error_string); return ret_error; } Modified: cherokee/trunk/cherokee/icons.c =================================================================== --- cherokee/trunk/cherokee/icons.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/icons.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -255,7 +255,7 @@ return ret_ok; } - PRINT_MSG_S ("A default icons is needed\n"); + LOG_CRITICAL_S ("A default icons is needed\n"); return ret_error; } @@ -287,7 +287,7 @@ ret = cherokee_icons_add_suffix (icons, key, &file_buf); if (ret != ret_ok) { - PRINT_ERROR ("Couldn't assign suffix '%s' to file '%s'\n", file, key->buf); + LOG_ERROR ("Couldn't assign suffix '%s' to file '%s'\n", file, key->buf); return ret_error; } Modified: cherokee/trunk/cherokee/init.c =================================================================== --- cherokee/trunk/cherokee/init.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/init.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -68,7 +68,7 @@ */ dcc_ncpus (&cherokee_cpu_number); if (cherokee_cpu_number < 1) { - PRINT_ERROR ("Bad CPU number: %d, using 1\n", cherokee_cpu_number); + LOG_WARNING ("Bad CPU number: %d, using 1\n", cherokee_cpu_number); cherokee_cpu_number = 1; } @@ -80,7 +80,7 @@ */ ret = cherokee_sys_fdlimit_get (&cherokee_fdlimit); if (ret < ret_ok) { - PRINT_ERROR_S ("ERROR: Unable to get file descriptor limit\n"); + LOG_ERROR_S ("Unable to get file descriptor limit\n"); return ret; } Modified: cherokee/trunk/cherokee/logger.h =================================================================== --- cherokee/trunk/cherokee/logger.h 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/logger.h 2009-06-29 18:41:35 UTC (rev 3403) @@ -30,6 +30,7 @@ #define CHEROKEE_LOGGER_H #include <cherokee/common.h> +#include <cherokee/buffer.h> #include <cherokee/module.h> #include <cherokee/logger_writer.h> Modified: cherokee/trunk/cherokee/logger_ncsa.c =================================================================== --- cherokee/trunk/cherokee/logger_ncsa.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/logger_ncsa.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -30,10 +30,6 @@ #include <unistd.h> #include <fcntl.h> -#ifdef HAVE_SYSLOG_H -# include <syslog.h> -#endif - #ifdef HAVE_SYS_TIME_H # include <sys/time.h> #else Modified: cherokee/trunk/cherokee/logger_writer.c =================================================================== --- cherokee/trunk/cherokee/logger_writer.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/logger_writer.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -37,7 +37,14 @@ # include <syslog.h> #endif +typedef struct { + CHEROKEE_MUTEX_T (mutex); + int foo; +} priv_t; +#define PRIV(l) ((priv_t *)(l->priv)) + + ret_t cherokee_logger_writer_new (cherokee_logger_writer_t **writer) { @@ -54,7 +61,12 @@ cherokee_buffer_init (&n->buffer); cherokee_buffer_ensure_size (&n->buffer, n->max_bufsize); - CHEROKEE_MUTEX_INIT (&n->mutex, NULL); + + n->priv = malloc (sizeof(priv_t)); + if (n->priv == NULL) { + return ret_nomem; + } + CHEROKEE_MUTEX_INIT (&PRIV(n)->mutex, NULL); *writer = n; return ret_ok; @@ -89,8 +101,9 @@ cherokee_buffer_mrproper (&writer->filename); cherokee_buffer_mrproper (&writer->command); - CHEROKEE_MUTEX_DESTROY (&writer->mutex); - + CHEROKEE_MUTEX_DESTROY (&PRIV(writer)->mutex); + + free (writer->priv); free (writer); return ret; } @@ -199,7 +212,7 @@ pid_t pid; if (pipe (to_log_fds)) { - PRINT_ERRNO_S (errno, "Pipe error: '${errno}'"); + PRINT_ERROR ("Pipe error: errno=%d", errno); return ret_error; } @@ -220,7 +233,7 @@ SHOULDNT_HAPPEN; case -1: - PRINT_ERRNO_S (errno, "Fork failed: '${errno}'"); + PRINT_ERROR ("Fork failed, errno=%d", errno); break; default: @@ -278,7 +291,7 @@ { ret_t ret; - CHEROKEE_MUTEX_LOCK (&writer->mutex); + CHEROKEE_MUTEX_LOCK (&PRIV(writer)->mutex); switch (writer->type) { case cherokee_logger_writer_syslog: @@ -300,10 +313,10 @@ goto error; out: - CHEROKEE_MUTEX_UNLOCK (&writer->mutex); + CHEROKEE_MUTEX_UNLOCK (&PRIV(writer)->mutex); return ret_ok; error: - CHEROKEE_MUTEX_UNLOCK (&writer->mutex); + CHEROKEE_MUTEX_UNLOCK (&PRIV(writer)->mutex); return ret_error; } @@ -312,7 +325,7 @@ cherokee_logger_writer_get_buf (cherokee_logger_writer_t *writer, cherokee_buffer_t **buf) { *buf = &writer->buffer; - CHEROKEE_MUTEX_LOCK (&writer->mutex); + CHEROKEE_MUTEX_LOCK (&PRIV(writer)->mutex); return ret_ok; } @@ -320,7 +333,7 @@ ret_t cherokee_logger_writer_release_buf (cherokee_logger_writer_t *writer) { - CHEROKEE_MUTEX_UNLOCK (&writer->mutex); + CHEROKEE_MUTEX_UNLOCK (&PRIV(writer)->mutex); return ret_ok; } @@ -339,7 +352,7 @@ } if (!locked) { - CHEROKEE_MUTEX_LOCK (&writer->mutex); + CHEROKEE_MUTEX_LOCK (&PRIV(writer)->mutex); } /* If not, do the proper thing @@ -409,7 +422,7 @@ out: if (! locked) { - CHEROKEE_MUTEX_UNLOCK (&writer->mutex); + CHEROKEE_MUTEX_UNLOCK (&PRIV(writer)->mutex); } return ret; } Modified: cherokee/trunk/cherokee/logger_writer.h =================================================================== --- cherokee/trunk/cherokee/logger_writer.h 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/logger_writer.h 2009-06-29 18:41:35 UTC (rev 3403) @@ -55,7 +55,7 @@ cherokee_buffer_t filename; cherokee_buffer_t command; - CHEROKEE_MUTEX_T (mutex); + void *priv; } cherokee_logger_writer_t; #define LOGGER_WRITER(x) ((cherokee_logger_writer_t *)(x)) Modified: cherokee/trunk/cherokee/macros.h =================================================================== --- cherokee/trunk/cherokee/macros.h 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/macros.h 2009-06-29 18:41:35 UTC (rev 3403) @@ -282,13 +282,11 @@ /* Printing macros */ #ifdef __GNUC__ -# define PRINT_MSG(fmt,arg...) fprintf(stderr, fmt, ##arg) -# define PRINT_ERROR(fmt,arg...) fprintf(stderr, "%s:%d - "fmt, __FILE__, __LINE__, ##arg) -# define PRINT_ERRNO(err,fmt,arg...) cherokee_print_errno(err, "%s:%d - "fmt"\n", __FILE__, __LINE__, ##arg) +# define PRINT_MSG(fmt,arg...) fprintf(stderr, fmt, ##arg) +# define PRINT_ERROR(fmt,arg...) fprintf(stderr, "%s:%d - "fmt, __FILE__, __LINE__, ##arg) #else -# define PRINT_MSG(fmt,...) fprintf(stderr, fmt, __VA_ARGS__) -# define PRINT_ERROR(fmt,...) fprintf(stderr, "%s:%d - "fmt, __FILE__, __LINE__, __VA_ARGS__) -# define PRINT_ERRNO(err,fmt,...) cherokee_print_errno(err, "%s:%d - "fmt"\n", __FILE__, __LINE__, __VA_ARGS__) +# define PRINT_MSG(fmt,...) fprintf(stderr, fmt, __VA_ARGS__) +# define PRINT_ERROR(fmt,...) fprintf(stderr, "%s:%d - "fmt, __FILE__, __LINE__, __VA_ARGS__) #endif #ifdef DEBUG @@ -305,7 +303,6 @@ # endif #endif -#define PRINT_ERRNO_S(e,str) PRINT_ERRNO(e, str, "") #define PRINT_ERROR_S(str) PRINT_ERROR("%s",str) #define PRINT_MSG_S(str) PRINT_MSG("%s",str) Modified: cherokee/trunk/cherokee/main_tweak.c =================================================================== --- cherokee/trunk/cherokee/main_tweak.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/main_tweak.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -258,7 +258,7 @@ */ re = rename (log->buf, newname.buf); if (re != 0) { - PRINT_ERRNO (errno, "Could not move '%s' to '%s': '${errno}'", log->buf, newname.buf); + PRINT_ERROR ("Could not move '%s' to '%s': errno=%d", log->buf, newname.buf, errno); } printf ("Log file '%s' moved to '%s' successfully\n", log->buf, newname.buf); Modified: cherokee/trunk/cherokee/main_worker.c =================================================================== --- cherokee/trunk/cherokee/main_worker.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/main_worker.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -104,7 +104,7 @@ else if (errno == EINTR) continue; else { - PRINT_ERRNO (errno, "ERROR: waitting PID %d: ${errno}\n", pid); + PRINT_ERROR ("ERROR: waitting PID %d, error %d\n", pid, errno); return; } } Modified: cherokee/trunk/cherokee/ncpus.c =================================================================== --- cherokee/trunk/cherokee/ncpus.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/ncpus.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -58,7 +58,8 @@ return 0; } else { *ncpus = -1; - PRINT_ERRNO (errno, "pstat_getdynamic failed: '${errno}'"); + LOG_ERRNO (errno, cherokee_err_error, + "pstat_getdynamic failed: '${errno}'"); return EXIT_DISTCC_FAILED; } } @@ -108,10 +109,10 @@ mib[0] = CTL_HW; mib[1] = HW_NCPU; if (sysctl(mib, 2, ncpus, &len, NULL, 0) == 0) - return 0; + return 0; else { - PRINT_ERRNO (errno, "sysctl(CTL_HW:HW_NCPU) failed: '${errno}'"); - return EXIT_DISTCC_FAILED; + LOG_ERRNO (errno, cherokee_err_error, "sysctl(CTL_HW:HW_NCPU) failed: '${errno}'"); + return EXIT_DISTCC_FAILED; } } @@ -138,7 +139,8 @@ #endif if (*ncpus == -1) { - PRINT_ERRNO_S (errno, "sysconf(_SC_NPROCESSORS_ONLN) failed: '${errno}'"); + LOG_ERRNO_S (errno, cherokee_err_error, + "sysconf(_SC_NPROCESSORS_ONLN) failed: '${errno}'"); return EXIT_DISTCC_FAILED; } else if (*ncpus == 0) { /* If there are no cpus, what are we running on ? Modified: cherokee/trunk/cherokee/plugin_loader.c =================================================================== --- cherokee/trunk/cherokee/plugin_loader.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/plugin_loader.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -156,7 +156,7 @@ dlerror(); re = (void *) dlsym(dl_handle, sym); if ((error = dlerror()) != NULL) { - PRINT_MSG ("ERROR: %s\n", error); + LOG_ERROR ("%s\n", error); CHEROKEE_MUTEX_UNLOCK (&dlerror_mutex); return NULL; } @@ -191,7 +191,7 @@ CHEROKEE_MUTEX_LOCK (&dlerror_mutex); lib = dlopen (tmp.buf, flags); if (lib == NULL) { - PRINT_ERROR ("ERROR: dlopen(%s): %s\n", tmp.buf, dlerror()); + LOG_ERROR ("dlopen(%s): %s\n", tmp.buf, dlerror()); CHEROKEE_MUTEX_UNLOCK (&dlerror_mutex); cherokee_buffer_mrproper (&tmp); return ret_error; @@ -236,7 +236,7 @@ /* Only try to execute if it exists */ if (init_func == NULL) { - PRINT_ERROR ("WARNING: %s was not found\n", init_name.buf); + LOG_WARNING ("%s was not found\n", init_name.buf); cherokee_buffer_mrproper (&init_name); return ret_not_found; @@ -360,10 +360,10 @@ case ret_ok: break; case ret_error: - PRINT_ERROR ("ERROR: Can't open \"%s\" module\n", modname); + LOG_ERROR ("Can't open \"%s\" module\n", modname); return ret; case ret_not_found: - PRINT_ERROR ("ERROR: Can't read \"info\" structure from %s\n", modname); + LOG_ERROR ("Can't read \"info\" structure from %s\n", modname); return ret; default: SHOULDNT_HAPPEN; Modified: cherokee/trunk/cherokee/post.c =================================================================== --- cherokee/trunk/cherokee/post.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/post.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -79,7 +79,7 @@ if (! cherokee_buffer_is_empty (&post->tmp_file)) { re = unlink (post->tmp_file.buf); if (unlikely (re != 0)) { - PRINT_ERRNO (errno, "Couldn't remove %s: %s\n", post->tmp_file.buf); + LOG_ERRNO (errno, cherokee_err_error, "Couldn't remove %s: %s\n", post->tmp_file.buf); } TRACE(ENTRIES, "Removing '%s'\n", post->tmp_file.buf); Modified: cherokee/trunk/cherokee/regex.c =================================================================== --- cherokee/trunk/cherokee/regex.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/regex.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -89,7 +89,7 @@ tmp = pcre_compile (pattern, 0, &error_msg, &error_offset, NULL); if (tmp == NULL) { - PRINT_ERROR ("ERROR: regex <<%s>>: \"%s\", offset %d\n", pattern, error_msg, error_offset); + LOG_ERROR ("regex <<%s>>: \"%s\", offset %d\n", pattern, error_msg, error_offset); CHEROKEE_RWLOCK_UNLOCK (&table->rwlock); return ret_error; Modified: cherokee/trunk/cherokee/rule_bind.c =================================================================== --- cherokee/trunk/cherokee/rule_bind.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/rule_bind.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -67,8 +67,8 @@ ret = cherokee_config_node_get (conf, "bind", &subconf); if (ret != ret_ok) { - PRINT_ERROR ("Rule prio=%d needs an 'bind' property\n", - RULE(rule)->priority); + LOG_CRITICAL ("Rule prio=%d needs an 'bind' property\n", + RULE(rule)->priority); return ret_error; } @@ -79,8 +79,8 @@ bind_n = atoi(subconf2->val.buf); if (bind_n <= 0) { - PRINT_ERROR ("Rule prio=%d type='bind', invalid port=%d\n", - RULE(rule)->priority, bind_n); + LOG_CRITICAL ("Rule prio=%d type='bind', invalid port=%d\n", + RULE(rule)->priority, bind_n); return ret_error; } Modified: cherokee/trunk/cherokee/rule_directory.c =================================================================== --- cherokee/trunk/cherokee/rule_directory.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/rule_directory.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -116,8 +116,8 @@ ret = cherokee_config_node_copy (conf, "directory", &rule->directory); if (ret != ret_ok) { - PRINT_ERROR ("Rule prio=%d needs a 'directory' property\n", - RULE(rule)->priority); + LOG_CRITICAL ("Rule prio=%d needs a 'directory' property\n", + RULE(rule)->priority); return ret_error; } Modified: cherokee/trunk/cherokee/rule_exists.c =================================================================== --- cherokee/trunk/cherokee/rule_exists.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/rule_exists.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -90,8 +90,8 @@ if (rule->match_any == false) { ret = cherokee_config_node_read (conf, "exists", &tmp); if (ret != ret_ok) { - PRINT_ERROR ("Rule prio=%d needs an 'exists' property\n", - RULE(rule)->priority); + LOG_CRITICAL ("Rule prio=%d needs an 'exists' property\n", + RULE(rule)->priority); return ret_error; } Modified: cherokee/trunk/cherokee/rule_extensions.c =================================================================== --- cherokee/trunk/cherokee/rule_extensions.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/rule_extensions.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -66,8 +66,8 @@ ret = cherokee_config_node_read (conf, "extensions", &tmp); if (ret != ret_ok) { - PRINT_ERROR ("Rule prio=%d needs an 'extensions' property\n", - RULE(rule)->priority); + LOG_CRITICAL ("Rule prio=%d needs an 'extensions' property\n", + RULE(rule)->priority); return ret_error; } Modified: cherokee/trunk/cherokee/rule_from.c =================================================================== --- cherokee/trunk/cherokee/rule_from.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/rule_from.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -66,8 +66,8 @@ ret = cherokee_config_node_get (conf, "from", &subconf); if (ret != ret_ok) { - PRINT_ERROR ("Rule prio=%d needs an 'from' property\n", - RULE(rule)->priority); + LOG_CRITICAL ("Rule prio=%d needs an 'from' property\n", + RULE(rule)->priority); return ret_error; } @@ -76,7 +76,7 @@ ret = cherokee_access_add (&rule->access, subconf2->val.buf); if (ret != ret_ok) { - PRINT_ERROR ("ERROR: Couldn't parse 'from' entry: '%s'\n", subconf2->val.buf); + LOG_ERROR ("Couldn't parse 'from' entry: '%s'\n", subconf2->val.buf); return ret_error; } } Modified: cherokee/trunk/cherokee/rule_fullpath.c =================================================================== --- cherokee/trunk/cherokee/rule_fullpath.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/rule_fullpath.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -49,8 +49,8 @@ */ ret = cherokee_config_node_get (conf, "fullpath", &subconf); if (ret != ret_ok) { - PRINT_ERROR ("Rule prio=%d needs a 'fullpath' property\n", - RULE(rule)->priority); + LOG_CRITICAL ("Rule prio=%d needs a 'fullpath' property\n", + RULE(rule)->priority); return ret_error; } Modified: cherokee/trunk/cherokee/rule_geoip.c =================================================================== --- cherokee/trunk/cherokee/rule_geoip.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/rule_geoip.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -151,8 +151,8 @@ ret = cherokee_config_node_read (conf, "countries", &tmp); if (ret != ret_ok) { - PRINT_ERROR ("Rule prio=%d needs an 'geoip' property\n", - RULE(rule)->priority); + LOG_CRITICAL ("Rule prio=%d needs an 'geoip' property\n", + RULE(rule)->priority); return ret_error; } Modified: cherokee/trunk/cherokee/rule_header.c =================================================================== --- cherokee/trunk/cherokee/rule_header.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/rule_header.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -97,7 +97,7 @@ } else if (equal_buf_str (header, "Host")) { *common_header = header_host; } else { - PRINT_ERROR ("ERROR: Unknown header: '%s'\n", header->buf); + LOG_CRITICAL ("Unknown header: '%s'\n", header->buf); return ret_error; } @@ -118,8 +118,8 @@ */ ret = cherokee_config_node_read (conf, "header", &header); if (ret != ret_ok) { - PRINT_ERROR ("Rule header prio=%d needs a 'header' entry\n", - RULE(rule)->priority); + LOG_ERROR ("Rule header prio=%d needs a 'header' entry\n", + RULE(rule)->priority); return ret_error; } @@ -131,8 +131,8 @@ */ ret = cherokee_config_node_copy (conf, "match", &rule->match); if (ret != ret_ok) { - PRINT_ERROR ("Rule header prio=%d needs a 'match' entry\n", - RULE(rule)->priority); + LOG_ERROR ("Rule header prio=%d needs a 'match' entry\n", + RULE(rule)->priority); return ret_error; } Modified: cherokee/trunk/cherokee/rule_method.c =================================================================== --- cherokee/trunk/cherokee/rule_method.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/rule_method.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -46,14 +46,14 @@ ret = cherokee_config_node_read (conf, "method", &tmp); if (ret != ret_ok) { - PRINT_ERROR ("Rule prio=%d needs an 'method' property\n", - RULE(rule)->priority); + LOG_CRITICAL ("Rule prio=%d needs an 'method' property\n", + RULE(rule)->priority); return ret_error; } ret = cherokee_http_string_to_method (tmp, &rule->method); if (ret != ret_ok) { - PRINT_ERROR ("Did not recognize HTTP method '%s'\n", tmp->buf); + LOG_CRITICAL ("Did not recognize HTTP method '%s'\n", tmp->buf); return ret; } Modified: cherokee/trunk/cherokee/rule_request.c =================================================================== --- cherokee/trunk/cherokee/rule_request.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/rule_request.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -49,12 +49,12 @@ /* Sanity checks */ if (unlikely (regexs == NULL)) { - PRINT_ERROR_S ("Couldn't access regex table\n"); + LOG_ERROR_S ("Couldn't access regex table\n"); return ret_error; } if (unlikely (rule->pcre == NULL)) { - PRINT_ERROR_S ("RegExp rule has null pcre\n"); + LOG_ERROR_S ("RegExp rule has null pcre\n"); return ret_error; } @@ -109,8 +109,7 @@ */ ret = cherokee_config_node_copy (conf, "request", &rule->pattern); if (ret != ret_ok) { - PRINT_ERROR ("Rule prio=%d needs a 'request' property\n", - RULE(rule)->priority); + LOG_CRITICAL ("Rule prio=%d needs a 'request' property\n", RULE(rule)->priority); return ret_error; } Modified: cherokee/trunk/cherokee/server.c =================================================================== --- cherokee/trunk/cherokee/server.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/server.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -911,7 +911,8 @@ re = chroot (srv->chroot.buf); srv->chrooted = (re == 0); if (srv->chrooted == 0) { - PRINT_ERRNO (errno, "Cannot chroot() to '%s': '${errno}'", srv->chroot.buf); + LOG_ERRNO (errno, cherokee_err_error, + "Cannot chroot() to '%s': '${errno}'", srv->chroot.buf); return ret_error; } } @@ -931,7 +932,7 @@ */ re = chdir ("/"); if (re < 0) { - PRINT_ERRNO_S (errno, "Couldn't chdir(\"/\"): '${errno}'"); + LOG_ERRNO_S (errno, cherokee_err_error, "Couldn't chdir(\"/\"): '${errno}'"); return ret_error; } @@ -1749,7 +1750,7 @@ #else int val = re; #endif - PRINT_ERROR ("PANIC: re-panic: '%s', status %d\n", cmd.buf, val); + LOG_CRITICAL ("PANIC: re-panic: '%s', status %d\n", cmd.buf, val); } cherokee_buffer_mrproper (&cmd); @@ -1865,7 +1866,8 @@ file = fopen (srv->pidfile.buf, "w+"); if (file == NULL) { - PRINT_ERRNO (errno, "Cannot write PID file '%s': '${errno}'", srv->pidfile.buf); + LOG_ERRNO (errno, cherokee_err_error, + "Cannot write PID file '%s': '${errno}'", srv->pidfile.buf); goto error; } Modified: cherokee/trunk/cherokee/socket.c =================================================================== --- cherokee/trunk/cherokee/socket.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/socket.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -270,7 +270,7 @@ break; #endif default: - PRINT_ERROR ("ERROR: Unknown socket family: %d\n", SOCKET_AF(socket)); + LOG_CRITICAL ("Unknown socket family: %d\n", SOCKET_AF(socket)); return ret_error; } @@ -376,8 +376,8 @@ re = 1; re = setsockopt (new_socket, SOL_SOCKET, SO_KEEPALIVE, &re, sizeof(re)); if (re == -1) { - PRINT_ERRNO (errno, "WARNING: Couldn't set SO_KEEPALIVE on fd=%d: ${errno}", - new_socket); + LOG_ERRNO (errno, cherokee_err_warning, + "Couldn't set SO_KEEPALIVE on fd=%d: ${errno}", new_socket); } linger.l_onoff = 1; @@ -385,8 +385,8 @@ re = setsockopt (new_socket, SOL_SOCKET, SO_LINGER, &linger, sizeof(linger)); if (re == -1) { - PRINT_ERRNO (errno, "WARNING: Couldn't set SO_LINGER on fd=%d: ${errno}", - new_socket); + LOG_ERRNO (errno, cherokee_err_warning, + "Couldn't set SO_LINGER on fd=%d: ${errno}", new_socket); } /* Close-on-exec: Child processes won't inherit this fd @@ -399,7 +399,7 @@ */ ret = cherokee_fd_set_nodelay (new_socket, true); if (ret != ret_ok) { - PRINT_ERROR_S ("Could not disable Nagle's algorithm.\n"); + LOG_WARNING_S ("Could not disable Nagle's algorithm.\n"); return ret_error; } @@ -407,7 +407,7 @@ */ ret = cherokee_fd_set_nonblocking (new_socket, true); if (ret != ret_ok) { - PRINT_ERROR_S ("Could not set non-blocking.\n"); + LOG_WARNING_S ("Could not set non-blocking.\n"); return ret_error; } @@ -518,13 +518,13 @@ re = stat (listen_to->buf, &buf); if (re == 0) { if (! S_ISSOCK(buf.st_mode)) { - PRINT_ERROR ("ERROR: %s isn't a socket!\n", listen_to->buf); + LOG_CRITICAL ("%s isn't a socket!\n", listen_to->buf); return ret_error; } re = unlink (listen_to->buf); if (re != 0) { - PRINT_ERROR ("ERROR: Couldn't remove %s\n", listen_to->buf); + LOG_ERROR ("Couldn't remove %s\n", listen_to->buf); return ret_error; } } @@ -639,7 +639,8 @@ return ret_error; } - PRINT_ERRNO (err, "write(%d, ..): '${errno}'", SOCKET_FD(socket)); + LOG_ERRNO (errno, cherokee_err_error, + "write(%d, ..): '${errno}'", SOCKET_FD(socket)); } return ret_error; @@ -728,7 +729,8 @@ return ret_error; } - PRINT_ERRNO (err, "read(%d, ..): '${errno}'", SOCKET_FD(socket)); + LOG_ERRNO (errno, cherokee_err_error, + "read(%d, ..): '${errno}'", SOCKET_FD(socket)); } return ret_error; @@ -932,7 +934,8 @@ return ret_error; } - PRINT_ERRNO (err, "writev(%d, ..): '${errno}'", SOCKET_FD(socket)); + LOG_ERRNO (errno, cherokee_err_error, + "writev(%d, ..): '${errno}'", SOCKET_FD(socket)); } return ret_error; @@ -1359,7 +1362,8 @@ #endif return ret_eagain; default: - PRINT_ERRNO_S (err, "Cannot connect: '${errno}'"); + LOG_ERRNO_S (errno, cherokee_err_error, + "Cannot connect: '${errno}'"); return ret_error; } } @@ -1413,7 +1417,8 @@ } while ((re == -1) && (errno == EINTR)); if (unlikely (re < 0)) { - PRINT_ERRNO (errno, "ERROR: Removing TCP_NODELAY to fd %d: ${errno}", fd); + LOG_ERRNO (errno, cherokee_err_error, + "Removing TCP_NODELAY to fd %d: ${errno}", fd); return ret_error; } @@ -1426,7 +1431,8 @@ } while ((re == -1) && (errno == EINTR)); if (unlikely (re < 0)) { - PRINT_ERRNO (errno, "ERROR: Setting TCP_CORK to fd %d: ${errno}", fd); + LOG_ERRNO (errno, cherokee_err_error, + "Setting TCP_CORK to fd %d: ${errno}", fd); return ret_error; } @@ -1442,7 +1448,8 @@ re = setsockopt (fd, IPPROTO_TCP, TCP_CORK, &tmp, sizeof(tmp)); } while ((re == -1) && (errno == EINTR)); if (unlikely (re < 0)) { - PRINT_ERRNO (errno, "ERROR: Removing TCP_CORK to fd %d: ${errno}", fd); + LOG_ERRNO (errno, cherokee_err_error, + "Removing TCP_CORK to fd %d: ${errno}", fd); return ret_error; } @@ -1454,7 +1461,8 @@ re = setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, &tmp, sizeof(tmp)); } while ((re == -1) && (errno == EINTR)); if (unlikely (re < 0)) { - PRINT_ERRNO (errno, "ERROR: Setting TCP_NODELAY to fd %d: ${errno}", fd); + LOG_ERRNO (errno, cherokee_err_error, + "Setting TCP_NODELAY to fd %d: ${errno}", fd); return ret_error; } Modified: cherokee/trunk/cherokee/source.c =================================================================== --- cherokee/trunk/cherokee/source.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/source.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -100,8 +100,8 @@ /* Set non-blocking */ ret = cherokee_fd_set_nonblocking (sock->socket, true); if (unlikely (ret != ret_ok)) { - PRINT_ERRNO (errno, "Failed to set nonblocking (fd=%d): ${errno}\n", - sock->socket); + LOG_ERRNO (errno, cherokee_err_error, + "Failed to set nonblocking (fd=%d): ${errno}\n", sock->socket); } goto out; @@ -128,8 +128,8 @@ /* Set non-blocking */ ret = cherokee_fd_set_nonblocking (sock->socket, true); if (unlikely (ret != ret_ok)) { - PRINT_ERRNO (errno, "Failed to set nonblocking (fd=%d): ${errno}\n", - sock->socket); + LOG_ERRNO (errno, cherokee_err_error, + "Failed to set nonblocking (fd=%d): ${errno}\n", sock->socket); } out: Modified: cherokee/trunk/cherokee/source_interpreter.c =================================================================== --- cherokee/trunk/cherokee/source_interpreter.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/source_interpreter.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -226,7 +226,7 @@ if (ret == ret_ok) return ret_ok; - PRINT_ERROR ("ERROR: Could find interpreter '%s'\n", src->interpreter.buf); + LOG_ERROR ("Could find interpreter '%s'\n", src->interpreter.buf); return ret_error; } @@ -268,8 +268,7 @@ ret = cherokee_getpwnam (child->val.buf, &pwd, tmp, sizeof(tmp)); if ((ret != ret_ok) || (pwd.pw_dir == NULL)) { - PRINT_MSG ("ERROR: User '%s' not found in the system\n", - child->val.buf); + LOG_CRITICAL ("User '%s' not found in the system\n", child->val.buf); return ret_error; } @@ -285,7 +284,7 @@ ret = cherokee_getgrnam (child->val.buf, &grp, tmp, sizeof(tmp)); if (ret != ret_ok) { - PRINT_MSG ("ERROR: Group '%s' not found in the system\n", conf->val.buf); + LOG_CRITICAL ("Group '%s' not found in the system\n", conf->val.buf); return ret_error; } @@ -304,13 +303,13 @@ /* Sanity check */ if (cherokee_buffer_is_empty (&src->interpreter)) { - PRINT_ERROR_S ("ERROR: 'Source interpreter' with no interpreter\n"); + LOG_CRITICAL_S ("'Source interpreter' with no interpreter\n"); return ret_error; } ret = check_interpreter (src); if (ret != ret_ok) { - PRINT_ERROR ("ERROR: Couldn't find interpreter '%s'\n", src->interpreter.buf); + LOG_ERROR ("Couldn't find interpreter '%s'\n", src->interpreter.buf); return ret_error; } @@ -472,7 +471,7 @@ argv[2] = (char *)tmp.buf; re = execve ("/bin/sh", (char **)argv, envp); if (re < 0) { - PRINT_ERROR ("ERROR: Could spawn %s\n", tmp.buf); + LOG_ERROR ("Could spawn %s\n", tmp.buf); exit (1); } Modified: cherokee/trunk/cherokee/spawner.c =================================================================== --- cherokee/trunk/cherokee/spawner.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/spawner.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -82,7 +82,8 @@ return ret_ok; error: - PRINT_ERRNO (errno, "Could initialize SHM '%s': ${errno}\n", name.buf); + LOG_ERRNO (errno, cherokee_err_error, + "Could initialize SHM '%s': ${errno}\n", name.buf); cherokee_buffer_mrproper (&name); return ret_error; @@ -255,7 +256,7 @@ */ ret = sem_signal (cherokee_spawn_sem); if (unlikely (ret != ret_ok)) { - PRINT_ERROR_S ("WARNING: Couldn't unlock spawning semaphore..\n"); + LOG_WARNING_S ("Couldn't unlock spawning semaphore..\n"); } /* Wait for the PID Modified: cherokee/trunk/cherokee/template.c =================================================================== --- cherokee/trunk/cherokee/template.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/template.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -216,7 +216,7 @@ } if (unlikely (repl->token == NULL)) { - PRINT_ERROR ("Template: Token not found '%s'\n", token.buf); + LOG_ERROR ("Template: Token not found '%s'\n", token.buf); ret = ret_error; goto out; } Modified: cherokee/trunk/cherokee/thread.c =================================================================== --- cherokee/trunk/cherokee/thread.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/thread.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -1016,8 +1016,8 @@ default: if ((MODULE(conn->handler)->info) && (MODULE(conn->handler)->info->name)) - PRINT_ERROR ("Unknown ret %d from handler %s\n", ret, - MODULE(conn->handler)->info->name); + LOG_ERROR ("Unknown ret %d from handler %s\n", ret, + MODULE(conn->handler)->info->name); else RET_UNKNOWN(ret); break; @@ -1344,7 +1344,7 @@ if (ret != ret_ok) goto out; - PRINT_ERROR_S ("WARNING: Run out of file descriptors!!\n"); + LOG_WARNING_S ("Run out of file descriptors!!\n"); /* Read the request */ @@ -1394,7 +1394,7 @@ */ ret = cherokee_thread_get_new_connection (thd, &new_conn); if (unlikely(ret < ret_ok)) { - PRINT_ERROR_S ("ERROR: Trying to get a new connection object\n"); + LOG_ERROR_S ("Trying to get a new connection object\n"); cherokee_fd_close (new_fd); return ret_deny; } @@ -1410,7 +1410,7 @@ CHEROKEE_MUTEX_LOCK (&thd->ownership); if (unlikely(ret < ret_ok)) { - PRINT_ERROR_S ("ERROR: Trying to set sockaddr\n"); + LOG_ERROR_S ("Trying to set sockaddr\n"); goto error; } Modified: cherokee/trunk/cherokee/util.c =================================================================== --- cherokee/trunk/cherokee/util.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/util.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -805,7 +805,7 @@ #else flags = fcntl (fd, F_GETFL, 0); if (unlikely (flags == -1)) { - PRINT_ERRNO (errno, "ERROR: fcntl/F_GETFL fd %d: ${errno}\n", fd); + LOG_ERRNO (errno, cherokee_err_error, "fcntl/F_GETFL fd %d: ${errno}\n", fd); return ret_error; } @@ -817,7 +817,7 @@ re = fcntl (fd, F_SETFL, flags); #endif if (unlikely (re < 0)) { - PRINT_ERRNO (errno, "ERROR: Setting O_NDELAY to fd %d: ${errno}\n", fd); + LOG_ERRNO (errno, cherokee_err_error, "Setting O_NDELAY to fd %d: ${errno}\n", fd); return ret_error; } @@ -835,7 +835,7 @@ #else flags = fcntl (fd, F_GETFL, 0); if (flags < 0) { - PRINT_ERRNO (errno, "ERROR: fcntl/F_GETFL fd %d: ${errno}\n", fd); + LOG_ERRNO (errno, cherokee_err_error, "fcntl/F_GETFL fd %d: ${errno}\n", fd); return ret_error; } @@ -847,7 +847,7 @@ re = fcntl (fd, F_SETFL, flags); #endif if (re < 0) { - PRINT_ERRNO (errno, "ERROR: Setting O_NONBLOCK to fd %d: ${errno}\n", fd); + LOG_ERRNO (errno, cherokee_err_error, "Setting O_NONBLOCK to fd %d: ${errno}\n", fd); return ret_error; } @@ -863,7 +863,7 @@ re = fcntl (fd, F_SETFD, FD_CLOEXEC); if (re < 0) { - PRINT_ERRNO (errno, "ERROR: Setting FD_CLOEXEC to fd %d: ${errno}\n", fd); + LOG_ERRNO (errno, cherokee_err_error, "Setting FD_CLOEXEC to fd %d: ${errno}\n", fd); return ret_error; } #endif @@ -1333,31 +1333,6 @@ } -void -cherokee_print_errno (int error, const char *format, ...) -{ - va_list ap; - const char *errstr; - char err_tmp[ERROR_MAX_BUFSIZE]; - cherokee_buffer_t buffer = CHEROKEE_BUF_INIT; - - errstr = cherokee_strerror_r (error, err_tmp, sizeof(err_tmp)); - if (errstr == NULL) - errstr = "unknwon error (?)"; - - cherokee_buffer_ensure_size (&buffer, 128); - va_start (ap, format); - cherokee_buffer_add_va_list (&buffer, format, ap); - va_end (ap); - - cherokee_buffer_replace_string (&buffer, (char *)"${errno}", 8, - (char *) errstr, strlen(errstr)); - PRINT_MSG_S (buffer.buf); - - cherokee_buffer_mrproper (&buffer); -} - - ret_t cherokee_mkstemp (cherokee_buffer_t *buffer, int *fd) { @@ -1420,7 +1395,7 @@ *p = '\0'; re = cherokee_mkdir (path->buf, 0700); if ((re != 0) && (errno != EEXIST)) { - PRINT_ERRNO (errno, "Could not mkdir '%s': ${errno}\n", path->buf); + LOG_ERRNO (errno, cherokee_err_error, "Could not mkdir '%s': ${errno}\n", path->buf); return ret_error; } *p = '/'; @@ -1432,7 +1407,7 @@ re = cherokee_mkdir (path->buf, 0700); if ((re != 0) && (errno != EEXIST)) { - PRINT_ERRNO (errno, "Could not mkdir '%s': ${errno}\n", path->buf); + LOG_ERRNO (errno, cherokee_err_error, "Could not mkdir '%s': ${errno}\n", path->buf); return ret_error; } Modified: cherokee/trunk/cherokee/util.h =================================================================== --- cherokee/trunk/cherokee/util.h 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/util.h 2009-06-29 18:41:35 UTC (rev 3403) @@ -61,6 +61,7 @@ #include <cherokee/buffer.h> #include <cherokee/iocache.h> + CHEROKEE_BEGIN_DECLS /* Error buffer size for cherokee_strerror_r(). @@ -168,9 +169,7 @@ /* Debug */ void cherokee_trace (const char *entry, const char *file, int line, const char *func, const char *fmt, ...); -void cherokee_print_errno (int error, const char *format, ...); - /* Path management */ ret_t cherokee_path_short (cherokee_buffer_t *path); Modified: cherokee/trunk/cherokee/validator_file.c =================================================================== --- cherokee/trunk/cherokee/validator_file.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/validator_file.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -74,7 +74,7 @@ } else if (equal_buf_str (&subconf->val, "local_dir")) { props->password_path_type = val_path_local_dir; } else { - PRINT_ERROR ("ERROR: Unknown path type '%s'\n", subconf->val.buf); + LOG_ERROR ("Unknown path type '%s'\n", subconf->val.buf); return ret_error; } } @@ -82,7 +82,7 @@ /* Final checks */ if (cherokee_buffer_is_empty (&props->password_file)) { - PRINT_MSG_S ("File based validators need a password file\n"); + LOG_CRITICAL_S ("File based validators need a password file\n"); return ret_error; } Modified: cherokee/trunk/cherokee/validator_ldap.c =================================================================== --- cherokee/trunk/cherokee/validator_ldap.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/validator_ldap.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -119,7 +119,7 @@ /* Not handled here */ } else { - PRINT_MSG ("ERROR: Validator LDAP: Unknown key: '%s'\n", subconf->key.buf); + PRINT_MSG ("Validator LDAP: Unknown key: '%s'\n", subconf->key.buf); return ret_error; } } @@ -127,22 +127,22 @@ /* Checks */ if (cherokee_buffer_is_empty (&props->basedn)) { - PRINT_ERROR_S ("ERROR: LDAP validator: An entry 'base_dn' is needed\n"); + LOG_ERROR_S ("LDAP validator: An entry 'base_dn' is needed\n"); return ret_error; } if (cherokee_buffer_is_empty (&props->filter)) { - PRINT_ERROR_S ("ERROR: LDAP validator: An entry 'filter' is needed\n"); + LOG_ERROR_S ("LDAP validator: An entry 'filter' is needed\n"); return ret_error; } if (cherokee_buffer_is_empty (&props->server)) { - PRINT_ERROR_S ("ERROR: LDAP validator: An entry 'server' is needed\n"); + LOG_ERROR_S ("LDAP validator: An entry 'server' is needed\n"); return ret_error; } if ((cherokee_buffer_is_empty (&props->bindpw) && (! cherokee_buffer_is_empty (&props->basedn)))) { - PRINT_ERROR_S ("ERROR: LDAP validator: Potential security problem found:\n" - "\tanonymous bind validation. Check (RFC 2251, section 4.2.2)\n"); + LOG_ERROR_S ("LDAP validator: Potential security problem found:\n" + "\tanonymous bind validation. Check (RFC 2251, section 4.2.2)\n"); return ret_error; } @@ -160,8 +160,9 @@ */ ldap->conn = ldap_init (props->server.buf, props->port); if (ldap->conn == NULL) { - PRINT_ERRNO (errno, "Couldn't connect to LDAP: %s:%d: '${errno}'", - props->server.buf, props->port); + LOG_ERRNO (errno, cherokee_err_critical, + "Couldn't connect to LDAP: %s:%d: '${errno}'", + props->server.buf, props->port); return ret_error; } @@ -172,8 +173,8 @@ val = LDAP_VERSION3; re = ldap_set_option (ldap->conn, LDAP_OPT_PROTOCOL_VERSION, &val); if (re != LDAP_OPT_SUCCESS) { - PRINT_ERROR ("ERROR: LDAP validator: Couldn't set the LDAP version 3: %s\n", - ldap_err2string (re)); + LOG_ERROR ("LDAP validator: Couldn't set the LDAP version 3: %s\n", + ldap_err2string (re)); return ret_error; } @@ -186,13 +187,13 @@ if (! cherokee_buffer_is_empty (&props->ca_file)) { re = ldap_set_option (NULL, LDAP_OPT_X_TLS_CACERTFILE, props->ca_file.buf); if (re != LDAP_OPT_SUCCESS) { - PRINT_ERROR ("ERROR: LDAP validator: Couldn't set CA file %s: %s\n", - props->ca_file.buf, ldap_err2string (re)); + LOG_CRITICAL ("LDAP validator: Couldn't set CA file %s: %s\n", + props->ca_file.buf, ldap_err2string (re)); return ret_error; } } #else - PRINT_ERROR_S ("Can't StartTLS, it isn't supported by LDAP client libraries\n"); + LOG_ERROR_S ("Can't StartTLS, it isn't supported by LDAP client libraries\n"); #endif } @@ -208,9 +209,9 @@ } if (re != LDAP_SUCCESS) { - PRINT_ERROR ("Couldn't bind (%s:%d): %s:%s : %s\n", - props->server.buf, props->port, props->binddn.buf, - props->bindpw.buf, ldap_err2string (re)); + LOG_CRITICAL ("Couldn't bind (%s:%d): %s:%s : %s\n", + props->server.buf, props->port, props->binddn.buf, + props->bindpw.buf, ldap_err2string (re)); return ret_error; } @@ -280,7 +281,7 @@ goto error; } #else - PRINT_ERROR_S ("Can't StartTLS, it isn't supported by LDAP client libraries\n"); + LOG_ERROR_S ("Can't StartTLS, it isn't supported by LDAP client libraries\n"); #endif } @@ -341,7 +342,7 @@ */ re = ldap_search_s (ldap->conn, props->basedn.buf, LDAP_SCOPE_SUBTREE, ldap->filter.buf, attrs, 0, &message); if (re != LDAP_SUCCESS) { - PRINT_ERROR ("Couldn't search in LDAP server: %s\n", props->filter.buf); + LOG_ERROR ("Couldn't search in LDAP server: %s\n", props->filter.buf); return ret_error; } Modified: cherokee/trunk/cherokee/validator_mysql.c =================================================================== --- cherokee/trunk/cherokee/validator_mysql.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/validator_mysql.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -122,15 +122,15 @@ /* Checks */ if (cherokee_buffer_is_empty (&props->user)) { - PRINT_ERROR_S ("ERROR: MySQL validator: an 'user' entry is needed\n"); + LOG_ERROR_S ("MySQL validator: an 'user' entry is needed\n"); return ret_error; } if (cherokee_buffer_is_empty (&props->database)) { - PRINT_ERROR_S ("ERROR: MySQL validator: a 'database' entry is needed\n"); + LOG_ERROR_S ("MySQL validator: a 'database' entry is needed\n"); return ret_error; } if (cherokee_buffer_is_empty (&props->query)) { - PRINT_ERROR_S ("ERROR: MySQL validator: a 'query' entry is needed\n"); + LOG_ERROR_S ("MySQL validator: a 'query' entry is needed\n"); return ret_error; } @@ -145,7 +145,7 @@ if (unlikely ((props->host.buf == NULL) && (props->unix_socket.buf == NULL))) { - PRINT_ERROR_S ("ERROR: MySQL validator misconfigured: A Host or Unix socket is needed."); + LOG_ERROR_S ("MySQL validator misconfigured: A Host or Unix socket is needed."); return ret_error; } @@ -161,8 +161,8 @@ props->port, props->unix_socket.buf, 0); if (conn == NULL) { - PRINT_ERROR ("Unable to connect to MySQL server: %s:%d %s\n", - props->host.buf, props->port, mysql_error (mysql->conn)); + LOG_ERROR ("Unable to connect to MySQL server: %s:%d %s\n", + props->host.buf, props->port, mysql_error (mysql->conn)); return ret_error; } Modified: cherokee/trunk/cherokee/virtual_server.c =================================================================== --- cherokee/trunk/cherokee/virtual_server.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/virtual_server.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -352,7 +352,7 @@ return ret; if ((entry->authentication & vinfo->valid_methods) != entry->authentication) { - PRINT_MSG ("ERROR: '%s' unsupported methods\n", tmp->buf); + LOG_CRITICAL ("Unsupported methods '%s'\n", tmp->buf); return ret_error; } @@ -375,7 +375,7 @@ entry->expiration = cherokee_expiration_time; ret = cherokee_config_node_read (conf, "time", &tmp); if (ret != ret_ok) { - PRINT_ERROR_S ("Expiration 'time' without a time property\n"); + LOG_ERROR_S ("Expiration 'time' without a time property\n"); return ret_error; } @@ -394,7 +394,7 @@ /* Ignore: Previously handled */ } else { - PRINT_MSG ("ERROR: Virtual Server parser: Unknown key \"%s\"\n", conf->key.buf); + LOG_CRITICAL ("Virtual Server parser: Unknown key \"%s\"\n", conf->key.buf); return ret_error; } @@ -466,7 +466,7 @@ /* Sanity check */ if (cherokee_buffer_is_empty (type)) { - PRINT_ERROR ("Rule match prio=%d must include a type property\n", priority); + LOG_CRITICAL ("Rule match prio=%d must include a type property\n", priority); return ret_error; } @@ -480,7 +480,7 @@ } else { ret = cherokee_plugin_loader_get (&srv->loader, type->buf, &info); if (ret < ret_ok) { - PRINT_MSG ("ERROR: Couldn't load rule module '%s'\n", type->buf); + LOG_CRITICAL ("ERROR: Couldn't load rule module '%s'\n", type->buf); return ret_error; } @@ -522,7 +522,7 @@ */ prio = atoi (config->key.buf); if (prio <= CHEROKEE_RULE_PRIO_NONE) { - PRINT_ERROR ("Invalid priority: '%s'\n", config->key.buf); + LOG_CRITICAL ("Invalid priority: '%s'\n", config->key.buf); return ret_error; } @@ -530,7 +530,7 @@ */ ret = cherokee_config_node_get (config, "match", &subconf); if (ret != ret_ok) { - PRINT_ERROR ("Rule prio=%d needs a 'match' section\n", prio); + LOG_CRITICAL ("Rule prio=%d needs a 'match' section\n", prio); return ret_error; } @@ -570,7 +570,7 @@ cherokee_server_t *srv = SRV(vserver->server_ref); if (cherokee_buffer_is_empty (&config->val)) { - PRINT_ERROR_S ("ERROR: A virtual server 'match' must be specified\n"); + LOG_CRITICAL_S ("A virtual server 'match' must be specified\n"); return ret_error; } @@ -578,7 +578,7 @@ */ ret = cherokee_plugin_loader_get (&srv->loader, config->val.buf, &info); if (ret < ret_ok) { - PRINT_MSG ("ERROR: Couldn't load vrule module '%s'\n", config->val.buf); + LOG_CRITICAL ("Couldn't load vrule module '%s'\n", config->val.buf); return ret_error; } @@ -617,7 +617,7 @@ */ ret = cherokee_plugin_loader_get (&srv->loader, config->val.buf, &info); if (ret < ret_ok) { - PRINT_MSG ("ERROR: Couldn't load evhost module '%s'\n", config->val.buf); + LOG_CRITICAL ("Couldn't load evhost module '%s'\n", config->val.buf); return ret_error; } @@ -662,7 +662,7 @@ */ ret = cherokee_plugin_loader_get (&srv->loader, config->val.buf, &info); if (ret < ret_ok) { - PRINT_MSG ("ERROR: Couldn't load logger module '%s'\n", config->val.buf); + LOG_CRITICAL ("Couldn't load logger module '%s'\n", config->val.buf); return ret_error; } @@ -810,7 +810,7 @@ cherokee_buffer_add_buffer (&vserver->ciphers, &conf->val); } else { - PRINT_MSG ("ERROR: Virtual Server: Unknown key '%s'\n", conf->key.buf); + LOG_CRITICAL ("Virtual Server: Unknown key '%s'\n", conf->key.buf); return ret_error; } @@ -838,12 +838,12 @@ /* Perform some sanity checks */ if (cherokee_buffer_is_empty (&vserver->name)) { - PRINT_MSG ("ERROR: Virtual host prio=%d needs a nick\n", prio); + LOG_CRITICAL ("Virtual host prio=%d needs a nick\n", prio); return ret_error; } if (cherokee_buffer_is_empty (&vserver->root)) { - PRINT_MSG ("ERROR: Virtual host '%s' needs a document_root\n", vserver->name.buf); + LOG_CRITICAL ("Virtual host '%s' needs a document_root\n", vserver->name.buf); return ret_error; } Modified: cherokee/trunk/cherokee/vrule_rehost.c =================================================================== --- cherokee/trunk/cherokee/vrule_rehost.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/vrule_rehost.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -67,7 +67,7 @@ ret = cherokee_config_node_get (conf, "regex", &subconf); if (ret != ret_ok) { - PRINT_ERROR ("Virtual Server '%s' regex vrule needs a 'domain' entry\n", vsrv->name.buf); + LOG_CRITICAL ("Virtual Server '%s' regex vrule needs a 'domain' entry\n", vsrv->name.buf); return ret_error; } Modified: cherokee/trunk/cherokee/vrule_wildcard.c =================================================================== --- cherokee/trunk/cherokee/vrule_wildcard.c 2009-06-29 18:36:27 UTC (rev 3402) +++ cherokee/trunk/cherokee/vrule_wildcard.c 2009-06-29 18:41:35 UTC (rev 3403) @@ -115,7 +115,7 @@ ret = cherokee_config_node_get (conf, "domain", &subconf); if (ret != ret_ok) { - PRINT_ERROR ("Virtual Server '%s' wildcard vrule needs a 'domain' entry\n", vsrv->name.buf); + LOG_CRITICAL ("Virtual Server '%s' wildcard vrule needs a 'domain' entry\n", vsrv->name.buf); return ret_error; }
|