Skip to content
Snippets Groups Projects
Commit 1bfae941 authored by Vladimír Čunát's avatar Vladimír Čunát
Browse files

Merge !1388: daemon/engine: warning when log_groups contains a non-existent group

parents 8c94968e a614818b
No related branches found
No related tags found
1 merge request!1388daemon/engine: warning when log_groups contains a non-existent group
Pipeline #110830 passed with warnings
......@@ -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);
}
......
......@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment