mirror of
https://github.com/lxsang/ant-http
synced 2024-11-17 17:08:20 +01:00
log level should be configured in config file
This commit is contained in:
parent
e7ec929709
commit
e9cd1addf7
@ -161,6 +161,10 @@ static int config_handler(void *conf, const char *section, const char *name,
|
||||
{
|
||||
pconfig->n_workers = atoi(value);
|
||||
}
|
||||
else if (MATCH("SERVER", "debug_enable"))
|
||||
{
|
||||
pconfig->debug_enable = atoi(value);
|
||||
}
|
||||
#ifdef USE_ZLIB
|
||||
else if (MATCH("SERVER", "gzip_enable"))
|
||||
{
|
||||
@ -269,6 +273,7 @@ void load_config(const char *file)
|
||||
server_config.ssl_cipher = NULL;
|
||||
server_config.gzip_enable = 0;
|
||||
server_config.gzip_types = NULL;
|
||||
server_config.debug_enable = 0;
|
||||
// put it default mimes
|
||||
for (int i = 0; _mimes[i].type != NULL; i++)
|
||||
{
|
||||
|
9
httpd.c
9
httpd.c
@ -339,7 +339,14 @@ int main(int argc, char *argv[])
|
||||
|
||||
config_t *conf = config();
|
||||
// start syslog
|
||||
setlogmask(LOG_UPTO(LOG_NOTICE));
|
||||
if(conf->debug_enable == 1)
|
||||
{
|
||||
setlogmask(LOG_UPTO(LOG_NOTICE));
|
||||
}
|
||||
else
|
||||
{
|
||||
setlogmask(LOG_UPTO(LOG_ERR));
|
||||
}
|
||||
openlog(SERVER_NAME, LOG_CONS | LOG_PID | LOG_NDELAY, LOG_DAEMON);
|
||||
|
||||
#ifdef USE_OPENSSL
|
||||
|
@ -93,6 +93,7 @@ typedef struct
|
||||
char *sslkey;
|
||||
char *ssl_cipher;
|
||||
int gzip_enable;
|
||||
int debug_enable;
|
||||
list_t gzip_types;
|
||||
dictionary_t mimes;
|
||||
dictionary_t ports;
|
||||
|
@ -43,12 +43,8 @@ THE SOFTWARE.
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
#ifdef DEBUG
|
||||
#define LOG(a,...) syslog (LOG_NOTICE,"ANTD_LOG@[%s: %d]: " a "\n", __FILE__, \
|
||||
#define LOG(a,...) syslog (LOG_NOTICE,"ANTD_LOG@[%s: %d]: " a "\n", __FILE__, \
|
||||
__LINE__, ##__VA_ARGS__)
|
||||
#else
|
||||
#define LOG(a,...) do{}while(0)
|
||||
#endif
|
||||
#define ERROR(a,...) syslog (LOG_ERR, "ANTD_ERROR@[%s: %d]: " a "\n", __FILE__, \
|
||||
__LINE__, ##__VA_ARGS__)
|
||||
// add this to the utils
|
||||
|
Loading…
Reference in New Issue
Block a user