summaryrefslogtreecommitdiff
path: root/sample/http-server.c
diff options
context:
space:
mode:
authorAzat Khuzhin <a3at.mail@gmail.com>2018-11-13 10:26:17 +0300
committerAzat Khuzhin <a3at.mail@gmail.com>2018-11-13 11:10:15 +0300
commit41b6b279cd8e03da7fea95b22c3aaf5cf9c82469 (patch)
tree320ddd3edfe4999687d54b69802cdd1f0bf4a611 /sample/http-server.c
parent3c8ded5c96c99b7fc6616cd2a9176159d53f50a1 (diff)
downloadlibevent-41b6b279cd8e03da7fea95b22c3aaf5cf9c82469.tar.gz
s/http-server: enable debug logging if EVENT_DEBUG_LOGGING_ALL env isset
Diffstat (limited to 'sample/http-server.c')
-rw-r--r--sample/http-server.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sample/http-server.c b/sample/http-server.c
index ae14b854..3b29b4c2 100644
--- a/sample/http-server.c
+++ b/sample/http-server.c
@@ -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");