def METHOD_NAME(self):
    osc.conf.config["debug"] = 0
    stdout = io.StringIO()
    stderr = io.StringIO()
    with contextlib.redirect_stdout(stdout), contextlib.redirect_stderr(stderr):
        print_msg("foo", "bar", print_to="debug")
    self.assertEqual("", stdout.getvalue())
    self.assertEqual("", stderr.getvalue())
    osc.conf.config["debug"] = 1
    stdout = io.StringIO()
    stderr = io.StringIO()
    with contextlib.redirect_stdout(stdout), contextlib.redirect_stderr(stderr):
        print_msg("foo", "bar", print_to="debug")
    self.assertEqual("", stdout.getvalue())
    self.assertEqual("DEBUG: foo bar\n", stderr.getvalue())