prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Move BlitzTUI log to RAM disk
  The RAM disk (`/var/cache/raspiblitz/`) is a nice way to avoid reads and writes to either the SD card or the external disk for non-persistent data. Several things can be moved; the BlitzTUI log should be  a prime example.
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `home.admin/BlitzTUI/blitztui/version.py`
  Content:
  ```
  1 """ Store the version here so:
  2 # 1) we don't load dependencies by storing it in __init__.py
  3 # 2) we can import it in setup.py for the same reason
  4 # 3) we can import it into your module module
  5 """
  6 
  7 __version_info__ = ('0', '47', '0')
  8 __version__ = '.'.join(__version_info__)
  9
  ```
  
  Path: `home.admin/BlitzTUI/blitztui/file_logger.py`
  Content:
  ```
  1 import json
  2 import logging
  3 import logging.config
  4 import os
  5 import sys
  6 
  7 IS_WIN32_ENV = sys.platform == "win32"
  8 
  9 
  10 def setup_logging(default_path=os.path.abspath(os.path.expanduser('~/.blitz-tui.json')), log_level="INFO"):
  11     """Setup logging configuration"""
  12     path = default_path
  13     if os.path.exists(path):
  14         with open(path, 'rt') as f:
  15             config = json.load(f)
  16         logging.config.dictConfig(config)
  17 
  18     else:  # if $default_path does not exist use the following default log setup
  19 
  20         if IS_WIN32_ENV:
  21             log_file = "blitz-tui.log"
  22         else:
  23             log_file = os.path.abspath(os.path.expanduser('~/blitz-tui.log'))
  24 
  25         default_config_as_dict = dict(
  26             version=1,
  27             disable_existing_loggers=False,
  28             formatters={'simple': {'format': '%(asctime)s - %(levelname)s - %(message)s'},
  29                         'extended': {
  30                             'format': '%(asctime)s - %(name)s - %(levelname)s - %(module)s:%(lineno)d - %(message)s'}},
  31             handlers={'console': {'class': 'logging.StreamHandler',
  32                                   'level': 'INFO',
  33                                   'formatter': 'extended',
  34                                   'stream': 'ext://sys.stdout'},
  35                       'file_handler': {'class': 'logging.handlers.RotatingFileHandler',
  36                                        'level': log_level,
  37                                        'formatter': 'extended',
  38                                        'filename': log_file,
  39                                        'maxBytes': 10485760,
  40                                        'backupCount': 0,
  41                                        'encoding': 'utf8'}},
  42             loggers={'infoblitz': {'level': 'DEBUG',
  43                                    'handlers': ['console', 'file_handler'],
  44                                    'propagate': 'no'}},
  45             root={'level': 'DEBUG', 'handlers': ['console', 'file_handler']}
  46         )
  47 
  48         logging.config.dictConfig(default_config_as_dict)
  49
  ```
  --- 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()
  
  ```
  
golden_diff: diff --git a/home.admin/BlitzTUI/blitztui/file_logger.py b/home.admin/BlitzTUI/blitztui/file_logger.py
  --- a/home.admin/BlitzTUI/blitztui/file_logger.py
  +++ b/home.admin/BlitzTUI/blitztui/file_logger.py
  @@ -1,3 +1,4 @@
  +import getpass
   import json
   import logging
   import logging.config
  @@ -20,7 +21,14 @@
           if IS_WIN32_ENV:
               log_file = "blitz-tui.log"
           else:
  -            log_file = os.path.abspath(os.path.expanduser('~/blitz-tui.log'))
  +            if os.path.isdir('/var/cache/raspiblitz'):
  +                try:
  +                    os.mkdir('/var/cache/raspiblitz/{}'.format(getpass.getuser()))
  +                except FileExistsError:
  +                    pass
  +                log_file = os.path.abspath('/var/cache/raspiblitz/{}/blitz-tui.log'.format(getpass.getuser()))
  +            else:
  +                log_file = os.path.abspath(os.path.expanduser('~/blitz-tui.log'))
   
           default_config_as_dict = dict(
               version=1,
  @@ -36,8 +44,8 @@
                                          'level': log_level,
                                          'formatter': 'extended',
                                          'filename': log_file,
  -                                       'maxBytes': 10485760,
  -                                       'backupCount': 0,
  +                                       'maxBytes': 2*1024*1024,  # 2 MB
  +                                       'backupCount': 1,
                                          'encoding': 'utf8'}},
               loggers={'infoblitz': {'level': 'DEBUG',
                                      'handlers': ['console', 'file_handler'],
  diff --git a/home.admin/BlitzTUI/blitztui/version.py b/home.admin/BlitzTUI/blitztui/version.py
  --- a/home.admin/BlitzTUI/blitztui/version.py
  +++ b/home.admin/BlitzTUI/blitztui/version.py
  @@ -4,5 +4,5 @@
   # 3) we can import it into your module module
   """
   
  -__version_info__ = ('0', '47', '0')
  +__version_info__ = ('0', '48', '1')
   __version__ = '.'.join(__version_info__)
  
verification_info: {"golden_diff": "diff --git a/home.admin/BlitzTUI/blitztui/file_logger.py b/home.admin/BlitzTUI/blitztui/file_logger.py\n--- a/home.admin/BlitzTUI/blitztui/file_logger.py\n+++ b/home.admin/BlitzTUI/blitztui/file_logger.py\n@@ -1,3 +1,4 @@\n+import getpass\n import json\n import logging\n import logging.config\n@@ -20,7 +21,14 @@\n         if IS_WIN32_ENV:\n             log_file = \"blitz-tui.log\"\n         else:\n-            log_file = os.path.abspath(os.path.expanduser('~/blitz-tui.log'))\n+            if os.path.isdir('/var/cache/raspiblitz'):\n+                try:\n+                    os.mkdir('/var/cache/raspiblitz/{}'.format(getpass.getuser()))\n+                except FileExistsError:\n+                    pass\n+                log_file = os.path.abspath('/var/cache/raspiblitz/{}/blitz-tui.log'.format(getpass.getuser()))\n+            else:\n+                log_file = os.path.abspath(os.path.expanduser('~/blitz-tui.log'))\n \n         default_config_as_dict = dict(\n             version=1,\n@@ -36,8 +44,8 @@\n                                        'level': log_level,\n                                        'formatter': 'extended',\n                                        'filename': log_file,\n-                                       'maxBytes': 10485760,\n-                                       'backupCount': 0,\n+                                       'maxBytes': 2*1024*1024,  # 2 MB\n+                                       'backupCount': 1,\n                                        'encoding': 'utf8'}},\n             loggers={'infoblitz': {'level': 'DEBUG',\n                                    'handlers': ['console', 'file_handler'],\ndiff --git a/home.admin/BlitzTUI/blitztui/version.py b/home.admin/BlitzTUI/blitztui/version.py\n--- a/home.admin/BlitzTUI/blitztui/version.py\n+++ b/home.admin/BlitzTUI/blitztui/version.py\n@@ -4,5 +4,5 @@\n # 3) we can import it into your module module\n \"\"\"\n \n-__version_info__ = ('0', '47', '0')\n+__version_info__ = ('0', '48', '1')\n __version__ = '.'.join(__version_info__)\n", "issue": "Move BlitzTUI log to RAM disk\nThe RAM disk (`/var/cache/raspiblitz/`) is a nice way to avoid reads and writes to either the SD card or the external disk for non-persistent data. Several things can be moved; the BlitzTUI log should be  a prime example.\n", "before_files": [{"content": "\"\"\" Store the version here so:\n# 1) we don't load dependencies by storing it in __init__.py\n# 2) we can import it in setup.py for the same reason\n# 3) we can import it into your module module\n\"\"\"\n\n__version_info__ = ('0', '47', '0')\n__version__ = '.'.join(__version_info__)\n", "path": "home.admin/BlitzTUI/blitztui/version.py"}, {"content": "import json\nimport logging\nimport logging.config\nimport os\nimport sys\n\nIS_WIN32_ENV = sys.platform == \"win32\"\n\n\ndef setup_logging(default_path=os.path.abspath(os.path.expanduser('~/.blitz-tui.json')), log_level=\"INFO\"):\n    \"\"\"Setup logging configuration\"\"\"\n    path = default_path\n    if os.path.exists(path):\n        with open(path, 'rt') as f:\n            config = json.load(f)\n        logging.config.dictConfig(config)\n\n    else:  # if $default_path does not exist use the following default log setup\n\n        if IS_WIN32_ENV:\n            log_file = \"blitz-tui.log\"\n        else:\n            log_file = os.path.abspath(os.path.expanduser('~/blitz-tui.log'))\n\n        default_config_as_dict = dict(\n            version=1,\n            disable_existing_loggers=False,\n            formatters={'simple': {'format': '%(asctime)s - %(levelname)s - %(message)s'},\n                        'extended': {\n                            'format': '%(asctime)s - %(name)s - %(levelname)s - %(module)s:%(lineno)d - %(message)s'}},\n            handlers={'console': {'class': 'logging.StreamHandler',\n                                  'level': 'INFO',\n                                  'formatter': 'extended',\n                                  'stream': 'ext://sys.stdout'},\n                      'file_handler': {'class': 'logging.handlers.RotatingFileHandler',\n                                       'level': log_level,\n                                       'formatter': 'extended',\n                                       'filename': log_file,\n                                       'maxBytes': 10485760,\n                                       'backupCount': 0,\n                                       'encoding': 'utf8'}},\n            loggers={'infoblitz': {'level': 'DEBUG',\n                                   'handlers': ['console', 'file_handler'],\n                                   'propagate': 'no'}},\n            root={'level': 'DEBUG', 'handlers': ['console', 'file_handler']}\n        )\n\n        logging.config.dictConfig(default_config_as_dict)\n", "path": "home.admin/BlitzTUI/blitztui/file_logger.py"}], "after_files": [{"content": "\"\"\" Store the version here so:\n# 1) we don't load dependencies by storing it in __init__.py\n# 2) we can import it in setup.py for the same reason\n# 3) we can import it into your module module\n\"\"\"\n\n__version_info__ = ('0', '48', '1')\n__version__ = '.'.join(__version_info__)\n", "path": "home.admin/BlitzTUI/blitztui/version.py"}, {"content": "import getpass\nimport json\nimport logging\nimport logging.config\nimport os\nimport sys\n\nIS_WIN32_ENV = sys.platform == \"win32\"\n\n\ndef setup_logging(default_path=os.path.abspath(os.path.expanduser('~/.blitz-tui.json')), log_level=\"INFO\"):\n    \"\"\"Setup logging configuration\"\"\"\n    path = default_path\n    if os.path.exists(path):\n        with open(path, 'rt') as f:\n            config = json.load(f)\n        logging.config.dictConfig(config)\n\n    else:  # if $default_path does not exist use the following default log setup\n\n        if IS_WIN32_ENV:\n            log_file = \"blitz-tui.log\"\n        else:\n            if os.path.isdir('/var/cache/raspiblitz'):\n                try:\n                    os.mkdir('/var/cache/raspiblitz/{}'.format(getpass.getuser()))\n                except FileExistsError:\n                    pass\n                log_file = os.path.abspath('/var/cache/raspiblitz/{}/blitz-tui.log'.format(getpass.getuser()))\n            else:\n                log_file = os.path.abspath(os.path.expanduser('~/blitz-tui.log'))\n\n        default_config_as_dict = dict(\n            version=1,\n            disable_existing_loggers=False,\n            formatters={'simple': {'format': '%(asctime)s - %(levelname)s - %(message)s'},\n                        'extended': {\n                            'format': '%(asctime)s - %(name)s - %(levelname)s - %(module)s:%(lineno)d - %(message)s'}},\n            handlers={'console': {'class': 'logging.StreamHandler',\n                                  'level': 'INFO',\n                                  'formatter': 'extended',\n                                  'stream': 'ext://sys.stdout'},\n                      'file_handler': {'class': 'logging.handlers.RotatingFileHandler',\n                                       'level': log_level,\n                                       'formatter': 'extended',\n                                       'filename': log_file,\n                                       'maxBytes': 2*1024*1024,  # 2 MB\n                                       'backupCount': 1,\n                                       'encoding': 'utf8'}},\n            loggers={'infoblitz': {'level': 'DEBUG',\n                                   'handlers': ['console', 'file_handler'],\n                                   'propagate': 'no'}},\n            root={'level': 'DEBUG', 'handlers': ['console', 'file_handler']}\n        )\n\n        logging.config.dictConfig(default_config_as_dict)\n", "path": "home.admin/BlitzTUI/blitztui/file_logger.py"}]}