mirror of
https://github.com/libevent/libevent.git
synced 2025-01-31 09:12:55 +08:00
s/http-server: enable debug logging if EVENT_DEBUG_LOGGING_ALL env isset
This commit is contained in:
parent
3c8ded5c96
commit
41b6b279cd
@ -95,6 +95,7 @@ struct options
|
||||
{
|
||||
int port;
|
||||
int iocp;
|
||||
int verbose;
|
||||
};
|
||||
|
||||
/* Try to guess a good content-type for 'path' */
|
||||
@ -339,10 +340,11 @@ parse_opts(int argc, char **argv)
|
||||
|
||||
memset(&o, 0, sizeof(o));
|
||||
|
||||
while ((opt = getopt(argc, argv, "p:I")) != -1) {
|
||||
while ((opt = getopt(argc, argv, "p:Iv")) != -1) {
|
||||
switch (opt) {
|
||||
case 'p': o.port = atoi(optarg); break;
|
||||
case 'I': o.iocp = 1; break;
|
||||
case 'v': ++o.verbose; break;
|
||||
default : fprintf(stderr, "Unknown option %c\n", opt); break;
|
||||
}
|
||||
}
|
||||
@ -379,6 +381,10 @@ main(int argc, char **argv)
|
||||
setbuf(stdout, NULL);
|
||||
setbuf(stderr, NULL);
|
||||
|
||||
/** Read env like in regress" */
|
||||
if (o.verbose || getenv("EVENT_DEBUG_LOGGING_ALL"))
|
||||
event_enable_debug_logging(EVENT_DBG_ALL);
|
||||
|
||||
cfg = event_config_new();
|
||||
#ifdef _WIN32
|
||||
if (o.iocp) {
|
||||
@ -387,6 +393,7 @@ main(int argc, char **argv)
|
||||
event_config_set_num_cpus_hint(cfg, 8);
|
||||
}
|
||||
#endif
|
||||
|
||||
base = event_base_new_with_config(cfg);
|
||||
if (!base) {
|
||||
fprintf(stderr, "Couldn't create an event_base: exiting\n");
|
||||
|
Loading…
x
Reference in New Issue
Block a user