Repository: theacodes/nox (python)

Issue:
Add a `debug` function for the session logging
**How would this feature be useful?**
<!-- Describe any use cases this solves or frustrations it alleviates.   -->
On #482, I introduced a `session.warn` functionality. Then, I started to use it on my local projects. And it works pretty fine! Now,
I would like to use... something like a `session.debug` method to expose "low errors".

**Describe the solution you'd like**
<!-- If you have an idea of how to do this, write it here! -->
A `session.debug` function, or something similar.

**Describe alternatives you've considered**
<!-- If there's some workaround or alternative solutions, let us know. -->
N/A


Pull request description:
Add `session.debug` to show debug-level messages
Closes #485. A logging function to show debug-level messages.

Patch:
diff --git a/nox/sessions.py b/nox/sessions.py
index 78a0286..08c9cb4 100644
--- a/nox/sessions.py
+++ b/nox/sessions.py
@@ -520,6 +520,10 @@ class Session:
         """Outputs a warning during the session."""
         logger.warning(*args, **kwargs)
 
+    def debug(self, *args: Any, **kwargs: Any) -> None:
+        """Outputs a debug-level message during the session."""
+        logger.debug(*args, **kwargs)
+
     def error(self, *args: Any) -> "_typing.NoReturn":
         """Immediately aborts the session and optionally logs an error."""
         raise _SessionQuit(*args)


Test patch:
diff --git a/tests/test_sessions.py b/tests/test_sessions.py
index 2d66ba9..6bcd916 100644
--- a/tests/test_sessions.py
+++ b/tests/test_sessions.py
@@ -609,6 +609,14 @@ class TestSession:
 
         assert "meep" in caplog.text
 
+    def test_debug(self, caplog):
+        caplog.set_level(logging.DEBUG)
+        session, _ = self.make_session_and_runner()
+
+        session.debug("meep")
+
+        assert "meep" in caplog.text
+
     def test_error(self, caplog):
         caplog.set_level(logging.ERROR)
         session, _ = self.make_session_and_runner()