feat: allow setting log level
This commit is contained in:
parent
eff1b13065
commit
3b1df332a3
3 changed files with 12 additions and 1 deletions
|
|
@ -45,6 +45,7 @@ static bool add_entry(char **key_ptr, int *key_len_ptr, http_loop_ctx *ctx,
|
|||
buf[key_len + 1] = '\0';
|
||||
|
||||
http_res_add_header(&ctx->res, http_header_location, buf, true);
|
||||
ctx->res.status = http_created;
|
||||
|
||||
if (key_ptr != NULL) {
|
||||
*key_ptr = key;
|
||||
|
|
|
|||
|
|
@ -5,7 +5,13 @@
|
|||
const char *log_level_names[] = {"DEBUG", "INFO ", "WARN ", "ERROR",
|
||||
"CRITICAL"};
|
||||
|
||||
log_level _log_level = log_level_debug;
|
||||
|
||||
void _lander_log(log_level level, FILE *f, const char *fmt, ...) {
|
||||
if (level < _log_level) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Log to stdout by default
|
||||
f = (f == NULL) ? stdout : f;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue