diff --git a/daemon/engine.c b/daemon/engine.c index 26c225f39e65adda281c058181f73a41228d1598..7ee56512166300d9e69b6f69b1c0c992b6b7e9bb 100644 --- a/daemon/engine.c +++ b/daemon/engine.c @@ -229,11 +229,14 @@ static int l_log_groups(lua_State *L) const char *grp_str = lua_tostring(L, -1); if (!grp_str) goto bad_call; + enum kr_log_group grp = kr_log_name2grp(grp_str); - if (grp < 0) - lua_error_p(L, "unknown log group '%s'", lua_tostring(L, -1)); + if (grp >= 0) { + kr_log_group_add(grp); + } else { + kr_log_warning(SYSTEM, "WARNING: unknown log group '%s'\n", lua_tostring(L, -1)); + } - kr_log_group_add(grp); ++idx; lua_pop(L, 1); } diff --git a/daemon/lua/log.test.lua b/daemon/lua/log.test.lua index 197aa74cc71478426559789588f9ec23ad40defc..ec5abd28c64301e29961881efa723e7a9371805e 100644 --- a/daemon/lua/log.test.lua +++ b/daemon/lua/log.test.lua @@ -30,8 +30,8 @@ local function test_log_groups() same(log_groups({'devel'}), {'devel'}, 'another call overrides previously set groups') same(log_groups({'devel', 'system'}), {'system', 'devel'}, 'configure multiple groups') same(log_groups({}), {}, 'clear groups with empty table') + same(log_groups({'nonexistent'}), {}, "nonexistent group is ignored") boom(log_groups, { 'string' }, "group argument can't be string") - boom(log_groups, { {'nonexistent'} }, "nonexistent group can't be added") boom(log_groups, { 1, 2 }, "group doesn't take multiple arguments") end