def assert_logged(self, msg=None, level=None, regex=True, **kwargs):
    'Provide assertion on whether a msg was logged at a given level\n\n            If neither `msg` nor `level` provided, checks if anything was logged\n            at all.\n\n            Parameters\n            ----------\n            msg: str, optional\n              Message (as a regular expression, if `regex`) to be searched.\n              If no msg provided, checks if anything was logged at a given level.\n            level: str, optional\n              String representing the level to be logged\n            regex: bool, optional\n              If False, regular `assert_in` is used\n            **kwargs: str, optional\n              Passed to `assert_re_in` or `assert_in`\n            '
    from datalad.tests.utils import assert_re_in
    from datalad.tests.utils import assert_in
    if regex:
        match = (('\\[%s\\] ' % level) if level else '\\[\\S+\\] ')
    else:
        match = (('[%s] ' % level) if level else '')
    if msg:
        match += msg
    if match:
        (assert_re_in if regex else assert_in)(match, self.out, **kwargs)
    else:
        assert (not kwargs), 'no kwargs to be passed anywhere'
        assert self.out, 'Nothing was logged!?'
Provide assertion on whether a msg was logged at a given level

If neither `msg` nor `level` provided, checks if anything was logged
at all.

Parameters
----------
msg: str, optional
  Message (as a regular expression, if `regex`) to be searched.
  If no msg provided, checks if anything was logged at a given level.
level: str, optional
  String representing the level to be logged
regex: bool, optional
  If False, regular `assert_in` is used
**kwargs: str, optional
  Passed to `assert_re_in` or `assert_in`
def assert_logged(self, msg=None, level=None, regex=True, **kwargs):
    'Provide assertion on whether a msg was logged at a given level\n\n            If neither `msg` nor `level` provided, checks if anything was logged\n            at all.\n\n            Parameters\n            ----------\n            msg: str, optional\n              Message (as a regular expression, if `regex`) to be searched.\n              If no msg provided, checks if anything was logged at a given level.\n            level: str, optional\n              String representing the level to be logged\n            regex: bool, optional\n              If False, regular `assert_in` is used\n            **kwargs: str, optional\n              Passed to `assert_re_in` or `assert_in`\n            '
    from datalad.tests.utils import assert_re_in
    from datalad.tests.utils import assert_in
    if regex:
        match = (('\\[%s\\] ' % level) if level else '\\[\\S+\\] ')
    else:
        match = (('[%s] ' % level) if level else )
    if msg:
        match += msg
    if match:
        (assert_re_in if regex else assert_in)(match, self.out, **kwargs)
    else:
        assert (not kwargs), 'no kwargs to be passed anywhere'
        assert self.out, 'Nothing was logged!?'