Repository: duartegroup/autodE
Pull request #231 (2023-01-17 09:45:16)

Add "ERROR" level to logging
AutodE did not previously recognise the ERROR level of logging if set by "export AUTODE_LOG_LEVEL=ERROR".


***

## Checklist

* [x] The changes include an associated explanation of how/why
* [x] Test pass
* [x] Documentation has been updated
* [x] Update changelog


codecov[bot]: # [Codecov](https://codecov.io/gh/duartegroup/autodE/pull/231?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=duartegroup) Report
> Merging [#231](https://codecov.io/gh/duartegroup/autodE/pull/231?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=duartegroup) (e665c6b) into [master](https://codecov.io/gh/duartegroup/autodE/commit/6813afd7523091352634f37339e75c9cf95f232f?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=duartegroup) (6813afd) will **decrease** coverage by `0.00%`.
> The diff coverage is `50.00%`.

```diff
@@            Coverage Diff             @@
##           master     #231      +/-   ##
==========================================
- Coverage   97.13%   97.12%   -0.01%     
==========================================
  Files         196      196              
  Lines       20131    20133       +2     
==========================================
+ Hits        19554    19555       +1     
- Misses        577      578       +1     
```

| Flag | Coverage Δ | |
|---|---|---|
| unittests | `97.12% <50.00%> (-0.01%)` | :arrow_down: |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=duartegroup#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Impacted Files](https://codecov.io/gh/duartegroup/autodE/pull/231?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=duartegroup) | Coverage Δ | |
|---|---|---|
| [autode/log/log.py](https://codecov.io/gh/duartegroup/autodE/pull/231?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=duartegroup#diff-YXV0b2RlL2xvZy9sb2cucHk=) | `90.62% <50.00%> (-2.71%)` | :arrow_down: |

Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=duartegroup). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=duartegroup)

shoubhikraj: @t-young31 Thanks! 😄 Happy for you to merge it.

Patch:
diff --git a/autode/log/log.py b/autode/log/log.py
index fb90850..0bbac83 100644
--- a/autode/log/log.py
+++ b/autode/log/log.py
@@ -3,7 +3,7 @@ import os
 
 """
 Set up logging with the standard python logging module. Set the log level with
-$AUTODE_LOG_LEVEL = {'', INFO, WARNING, DEBUG}
+$AUTODE_LOG_LEVEL = {'', ERROR, WARNING, INFO, DEBUG}
 
 i.e. export AUTODE_LOG_LEVEL=DEBUG
 
@@ -36,6 +36,9 @@ def get_log_level():
     if log_level_str == "INFO":
         return logging.INFO
 
+    if log_level_str == "ERROR":
+        return logging.ERROR
+
     return logging.CRITICAL
 
 
diff --git a/doc/changelog.rst b/doc/changelog.rst
index 43ab9f2..ab9c69a 100644
--- a/doc/changelog.rst
+++ b/doc/changelog.rst
@@ -1,6 +1,25 @@
 Changelog
 =========
 
+1.3.5
+--------
+----------
+
+
+Usability improvements/Changes
+******************************
+*
+
+
+Functionality improvements
+**************************
+-
+
+
+Bug Fixes
+*********
+- Fixes :code:`ERROR` logging level being ignored from environment variable :code:`AUTODE_LOG_LEVEL`
+
 1.3.4
 --------
 ----------
diff --git a/doc/config.rst b/doc/config.rst
index a3ea603..51c0dd8 100644
--- a/doc/config.rst
+++ b/doc/config.rst
@@ -136,7 +136,7 @@ to see all the options.
 Logging
 -------
 
-To set the logging level to one of {INFO, WARNING, ERROR} set the :code:`AUTODE_LOG_LEVEL`
+To set the logging level to one of {DEBUG, INFO, WARNING, ERROR} set the :code:`AUTODE_LOG_LEVEL`
 environment variable, in bash::
 
     $ export AUTODE_LOG_LEVEL=INFO
diff --git a/doc/reference/log.rst b/doc/reference/log.rst
index 78ac73d..aa3847d 100644
--- a/doc/reference/log.rst
+++ b/doc/reference/log.rst
@@ -11,7 +11,7 @@ Logging
 Logging
 -------
 
-To set the logging level to one of {INFO, WARNING, ERROR} set the AUTODE_LOG_LEVEL
+To set the logging level to one of {DEBUG, INFO, WARNING, ERROR} set the AUTODE_LOG_LEVEL
 environment variable, in bash::
 
     $ export AUTODE_LOG_LEVEL=INFO


Test patch:
diff --git a/tests/test_log.py b/tests/test_log.py
index e33bedc..e9bcbe5 100644
--- a/tests/test_log.py
+++ b/tests/test_log.py
@@ -14,6 +14,9 @@ def test_log_level():
     os.environ["AUTODE_LOG_LEVEL"] = "DEBUG"
     assert log.get_log_level() == log.logging.DEBUG
 
+    os.environ["AUTODE_LOG_LEVEL"] = "ERROR"
+    assert log.get_log_level() == log.logging.ERROR
+
     os.environ["AUTODE_LOG_LEVEL"] = "WARNING"
     assert log.get_log_level() == log.logging.WARNING