<p dir="ltr"><p dir="ltr">On 11 Sep. 2016 11:31, "Jim Nasby" <<a
href="mailto:Jim.Nasby@bluetreble.com">Jim.Nasby@bluetreble.com</a>>wrote:<p dir="ltr">> Actually, I wish this
wasa straight-up logging level feature, because I need it all the time when debugging complicated user-level code.
Specifically,I wish there was a GUC that would alter (client|log)_min_messages upon entering a specific function,
eitherfor just that function or for anything that function subsequently called.<p dir="ltr">We have that or close to
it,but it's restricted for security. IIRC you can't SET log_min_messages as non superuser including as part of CREATE
FUNCTION... SET. Presumably because lowering it would let the user hide activity admins expect to be recorded. Raising
itwould let them possibly DoS via log spam - though that argument is rather undermined by the ability to write plpgsql
thatdoes RAISE in a tight loop.<p dir="ltr">I'd like to be able to let users make logging more detailed but not less,
sothey can only SET it to something equal to or more detailed to what their session has art the start. Should actually
bepretty trivial to implement too.<p dir="ltr">You can then SET at session level, function level, SET LOCAL, etc. If
youwant to control it dynamically via GUC you add calls to your functions to check a custom user GUC and SET log level
accordingly.Using whatever logic you like.<br /><br /><p dir="ltr">> Bonus points if you could also specify a regex
thatthe message text had to match.<br /> ><p dir="ltr">An errfinish() hook would be nice for that.