We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Log level `DEPRECATION` is documented but not working
## Description of the issue

Log level `DEPRECATION` is documented but not working.

### Context information (for bug reports)

* Output of `pyinstaller --version`: ```5.7.0```
* Version of Python: 3.10.6
* Platform: Ubuntu 22.04
* How you installed Python: apt
* Did you also try this on another platform? Does it work there? yes, same thing
* try the latest development version, using the following command: yes, same thing

### A minimal example program which shows the error

```
$ pyinstaller --help | grep -U1 DEPREC
  --log-level LEVEL     Amount of detail in build-time console messages. LEVEL
                        may be one of TRACE, DEBUG, INFO, WARN, DEPRECATION,
                        ERROR, CRITICAL (default: INFO). Also settable via and
$ pyinstaller --log-level DEPRECATION .
[...]
pyinstaller: error: Unknown log level `DEPRECATION`
```


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `PyInstaller/log.py`
Content:
```
1 #-----------------------------------------------------------------------------
2 # Copyright (c) 2013-2023, PyInstaller Development Team.
3 #
4 # Distributed under the terms of the GNU General Public License (version 2
5 # or later) with exception for distributing the bootloader.
6 #
7 # The full license is in the file COPYING.txt, distributed with this software.
8 #
9 # SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)
10 #-----------------------------------------------------------------------------
11 """
12 Logging module for PyInstaller.
13 """
14 
15 __all__ = ['getLogger', 'INFO', 'WARN', 'DEBUG', 'TRACE', 'ERROR', 'FATAL', 'DEPRECATION']
16 
17 import os
18 import logging
19 from logging import DEBUG, ERROR, FATAL, INFO, WARN, getLogger
20 
21 TRACE = logging.TRACE = DEBUG - 5
22 logging.addLevelName(TRACE, 'TRACE')
23 DEPRECATION = WARN + 5
24 logging.addLevelName(DEPRECATION, 'DEPRECATION')
25 LEVELS = ('TRACE', 'DEBUG', 'INFO', 'WARN', 'DEPRECATION', 'ERROR', 'CRITICAL')
26 
27 FORMAT = '%(relativeCreated)d %(levelname)s: %(message)s'
28 _env_level = os.environ.get("PYI_LOG_LEVEL", "INFO")
29 try:
30     level = getattr(logging, _env_level.upper())
31 except AttributeError:
32     raise SystemExit(f"Invalid PYI_LOG_LEVEL value '{_env_level}'. Should be one of {LEVELS}.")
33 logging.basicConfig(format=FORMAT, level=level)
34 logger = getLogger('PyInstaller')
35 
36 
37 def __add_options(parser):
38     parser.add_argument(
39         '--log-level',
40         choices=LEVELS,
41         metavar="LEVEL",
42         dest='loglevel',
43         help='Amount of detail in build-time console messages. LEVEL may be one of %s (default: INFO). '
44         'Also settable via and overrides the PYI_LOG_LEVEL environment variable.' % ', '.join(LEVELS),
45     )
46 
47 
48 def __process_options(parser, opts):
49     if opts.loglevel:
50         try:
51             level = opts.loglevel.upper()
52             _level = getattr(logging, level)
53         except AttributeError:
54             parser.error('Unknown log level `%s`' % opts.loglevel)
55         logger.setLevel(_level)
56         os.environ["PYI_LOG_LEVEL"] = level
57
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/PyInstaller/log.py b/PyInstaller/log.py
--- a/PyInstaller/log.py
+++ b/PyInstaller/log.py
@@ -18,18 +18,26 @@
 import logging
 from logging import DEBUG, ERROR, FATAL, INFO, WARN, getLogger
 
-TRACE = logging.TRACE = DEBUG - 5
+TRACE = DEBUG - 5
 logging.addLevelName(TRACE, 'TRACE')
 DEPRECATION = WARN + 5
 logging.addLevelName(DEPRECATION, 'DEPRECATION')
-LEVELS = ('TRACE', 'DEBUG', 'INFO', 'WARN', 'DEPRECATION', 'ERROR', 'CRITICAL')
+LEVELS = {
+    'TRACE': TRACE,
+    'DEBUG': DEBUG,
+    'INFO': INFO,
+    'WARN': WARN,
+    'DEPRECATION': DEPRECATION,
+    'ERROR': ERROR,
+    'FATAL': FATAL,
+}
 
 FORMAT = '%(relativeCreated)d %(levelname)s: %(message)s'
 _env_level = os.environ.get("PYI_LOG_LEVEL", "INFO")
 try:
-    level = getattr(logging, _env_level.upper())
-except AttributeError:
-    raise SystemExit(f"Invalid PYI_LOG_LEVEL value '{_env_level}'. Should be one of {LEVELS}.")
+    level = LEVELS[_env_level.upper()]
+except KeyError:
+    raise SystemExit(f"Invalid PYI_LOG_LEVEL value '{_env_level}'. Should be one of {list(LEVELS)}.")
 logging.basicConfig(format=FORMAT, level=level)
 logger = getLogger('PyInstaller')
 
@@ -49,8 +57,8 @@
     if opts.loglevel:
         try:
             level = opts.loglevel.upper()
-            _level = getattr(logging, level)
-        except AttributeError:
+            _level = LEVELS[level]
+        except KeyError:
             parser.error('Unknown log level `%s`' % opts.loglevel)
         logger.setLevel(_level)
         os.environ["PYI_LOG_LEVEL"] = level

{"golden_diff": "diff --git a/PyInstaller/log.py b/PyInstaller/log.py\n--- a/PyInstaller/log.py\n+++ b/PyInstaller/log.py\n@@ -18,18 +18,26 @@\n import logging\n from logging import DEBUG, ERROR, FATAL, INFO, WARN, getLogger\n \n-TRACE = logging.TRACE = DEBUG - 5\n+TRACE = DEBUG - 5\n logging.addLevelName(TRACE, 'TRACE')\n DEPRECATION = WARN + 5\n logging.addLevelName(DEPRECATION, 'DEPRECATION')\n-LEVELS = ('TRACE', 'DEBUG', 'INFO', 'WARN', 'DEPRECATION', 'ERROR', 'CRITICAL')\n+LEVELS = {\n+    'TRACE': TRACE,\n+    'DEBUG': DEBUG,\n+    'INFO': INFO,\n+    'WARN': WARN,\n+    'DEPRECATION': DEPRECATION,\n+    'ERROR': ERROR,\n+    'FATAL': FATAL,\n+}\n \n FORMAT = '%(relativeCreated)d %(levelname)s: %(message)s'\n _env_level = os.environ.get(\"PYI_LOG_LEVEL\", \"INFO\")\n try:\n-    level = getattr(logging, _env_level.upper())\n-except AttributeError:\n-    raise SystemExit(f\"Invalid PYI_LOG_LEVEL value '{_env_level}'. Should be one of {LEVELS}.\")\n+    level = LEVELS[_env_level.upper()]\n+except KeyError:\n+    raise SystemExit(f\"Invalid PYI_LOG_LEVEL value '{_env_level}'. Should be one of {list(LEVELS)}.\")\n logging.basicConfig(format=FORMAT, level=level)\n logger = getLogger('PyInstaller')\n \n@@ -49,8 +57,8 @@\n     if opts.loglevel:\n         try:\n             level = opts.loglevel.upper()\n-            _level = getattr(logging, level)\n-        except AttributeError:\n+            _level = LEVELS[level]\n+        except KeyError:\n             parser.error('Unknown log level `%s`' % opts.loglevel)\n         logger.setLevel(_level)\n         os.environ[\"PYI_LOG_LEVEL\"] = level\n", "issue": "Log level `DEPRECATION` is documented but not working\n## Description of the issue\r\n\r\nLog level `DEPRECATION` is documented but not working.\r\n\r\n### Context information (for bug reports)\r\n\r\n* Output of `pyinstaller --version`: ```5.7.0```\r\n* Version of Python: 3.10.6\r\n* Platform: Ubuntu 22.04\r\n* How you installed Python: apt\r\n* Did you also try this on another platform? Does it work there? yes, same thing\r\n* try the latest development version, using the following command: yes, same thing\r\n\r\n### A minimal example program which shows the error\r\n\r\n```\r\n$ pyinstaller --help | grep -U1 DEPREC\r\n  --log-level LEVEL     Amount of detail in build-time console messages. LEVEL\r\n                        may be one of TRACE, DEBUG, INFO, WARN, DEPRECATION,\r\n                        ERROR, CRITICAL (default: INFO). Also settable via and\r\n$ pyinstaller --log-level DEPRECATION .\r\n[...]\r\npyinstaller: error: Unknown log level `DEPRECATION`\r\n```\r\n\n", "before_files": [{"content": "#-----------------------------------------------------------------------------\n# Copyright (c) 2013-2023, PyInstaller Development Team.\n#\n# Distributed under the terms of the GNU General Public License (version 2\n# or later) with exception for distributing the bootloader.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#\n# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)\n#-----------------------------------------------------------------------------\n\"\"\"\nLogging module for PyInstaller.\n\"\"\"\n\n__all__ = ['getLogger', 'INFO', 'WARN', 'DEBUG', 'TRACE', 'ERROR', 'FATAL', 'DEPRECATION']\n\nimport os\nimport logging\nfrom logging import DEBUG, ERROR, FATAL, INFO, WARN, getLogger\n\nTRACE = logging.TRACE = DEBUG - 5\nlogging.addLevelName(TRACE, 'TRACE')\nDEPRECATION = WARN + 5\nlogging.addLevelName(DEPRECATION, 'DEPRECATION')\nLEVELS = ('TRACE', 'DEBUG', 'INFO', 'WARN', 'DEPRECATION', 'ERROR', 'CRITICAL')\n\nFORMAT = '%(relativeCreated)d %(levelname)s: %(message)s'\n_env_level = os.environ.get(\"PYI_LOG_LEVEL\", \"INFO\")\ntry:\n    level = getattr(logging, _env_level.upper())\nexcept AttributeError:\n    raise SystemExit(f\"Invalid PYI_LOG_LEVEL value '{_env_level}'. Should be one of {LEVELS}.\")\nlogging.basicConfig(format=FORMAT, level=level)\nlogger = getLogger('PyInstaller')\n\n\ndef __add_options(parser):\n    parser.add_argument(\n        '--log-level',\n        choices=LEVELS,\n        metavar=\"LEVEL\",\n        dest='loglevel',\n        help='Amount of detail in build-time console messages. LEVEL may be one of %s (default: INFO). '\n        'Also settable via and overrides the PYI_LOG_LEVEL environment variable.' % ', '.join(LEVELS),\n    )\n\n\ndef __process_options(parser, opts):\n    if opts.loglevel:\n        try:\n            level = opts.loglevel.upper()\n            _level = getattr(logging, level)\n        except AttributeError:\n            parser.error('Unknown log level `%s`' % opts.loglevel)\n        logger.setLevel(_level)\n        os.environ[\"PYI_LOG_LEVEL\"] = level\n", "path": "PyInstaller/log.py"}], "after_files": [{"content": "#-----------------------------------------------------------------------------\n# Copyright (c) 2013-2023, PyInstaller Development Team.\n#\n# Distributed under the terms of the GNU General Public License (version 2\n# or later) with exception for distributing the bootloader.\n#\n# The full license is in the file COPYING.txt, distributed with this software.\n#\n# SPDX-License-Identifier: (GPL-2.0-or-later WITH Bootloader-exception)\n#-----------------------------------------------------------------------------\n\"\"\"\nLogging module for PyInstaller.\n\"\"\"\n\n__all__ = ['getLogger', 'INFO', 'WARN', 'DEBUG', 'TRACE', 'ERROR', 'FATAL', 'DEPRECATION']\n\nimport os\nimport logging\nfrom logging import DEBUG, ERROR, FATAL, INFO, WARN, getLogger\n\nTRACE = DEBUG - 5\nlogging.addLevelName(TRACE, 'TRACE')\nDEPRECATION = WARN + 5\nlogging.addLevelName(DEPRECATION, 'DEPRECATION')\nLEVELS = {\n    'TRACE': TRACE,\n    'DEBUG': DEBUG,\n    'INFO': INFO,\n    'WARN': WARN,\n    'DEPRECATION': DEPRECATION,\n    'ERROR': ERROR,\n    'FATAL': FATAL,\n}\n\nFORMAT = '%(relativeCreated)d %(levelname)s: %(message)s'\n_env_level = os.environ.get(\"PYI_LOG_LEVEL\", \"INFO\")\ntry:\n    level = LEVELS[_env_level.upper()]\nexcept KeyError:\n    raise SystemExit(f\"Invalid PYI_LOG_LEVEL value '{_env_level}'. Should be one of {list(LEVELS)}.\")\nlogging.basicConfig(format=FORMAT, level=level)\nlogger = getLogger('PyInstaller')\n\n\ndef __add_options(parser):\n    parser.add_argument(\n        '--log-level',\n        choices=LEVELS,\n        metavar=\"LEVEL\",\n        dest='loglevel',\n        help='Amount of detail in build-time console messages. LEVEL may be one of %s (default: INFO). '\n        'Also settable via and overrides the PYI_LOG_LEVEL environment variable.' % ', '.join(LEVELS),\n    )\n\n\ndef __process_options(parser, opts):\n    if opts.loglevel:\n        try:\n            level = opts.loglevel.upper()\n            _level = LEVELS[level]\n        except KeyError:\n            parser.error('Unknown log level `%s`' % opts.loglevel)\n        logger.setLevel(_level)\n        os.environ[\"PYI_LOG_LEVEL\"] = level\n", "path": "PyInstaller/log.py"}]}