diff --git a/doc/data/messages/l/logging-not-lazy/bad.py b/doc/data/messages/l/logging-not-lazy/bad.py new file mode 100644 index 0000000000..be6b98cb61 --- /dev/null +++ b/doc/data/messages/l/logging-not-lazy/bad.py @@ -0,0 +1,7 @@ +import logging + +try: + function() +except Exception as e: + logging.error('Error occured: %s' % e) # [logging-not-lazy] + raise diff --git a/doc/data/messages/l/logging-not-lazy/details.rst b/doc/data/messages/l/logging-not-lazy/details.rst new file mode 100644 index 0000000000..138c423c80 --- /dev/null +++ b/doc/data/messages/l/logging-not-lazy/details.rst @@ -0,0 +1,2 @@ +Another reasonable option is to use f-strings. If you want to do that, you need to enable +``logging-not-lazy`` and disable ``logging-fstring-interpolation``. diff --git a/doc/data/messages/l/logging-not-lazy/good.py b/doc/data/messages/l/logging-not-lazy/good.py new file mode 100644 index 0000000000..ac8503ec99 --- /dev/null +++ b/doc/data/messages/l/logging-not-lazy/good.py @@ -0,0 +1,7 @@ +import logging + +try: + function() +except Exception as e: + logging.error('Error occured: %s', e) + raise diff --git a/doc/data/messages/l/logging-not-lazy/related.rst b/doc/data/messages/l/logging-not-lazy/related.rst new file mode 100644 index 0000000000..e6faa3870d --- /dev/null +++ b/doc/data/messages/l/logging-not-lazy/related.rst @@ -0,0 +1,2 @@ +- `Logging variable data `_ +- `Rationale `_