import logging

logger = logging.getLogger("LanguageClient")
fileHandler = logging.FileHandler(filename="/tmp/LanguageClient.log")
fileHandler.setFormatter(
    logging.Formatter(
        "%(asctime)s %(levelname)-8s %(message)s",
        "%H:%M:%S"))
logger.addHandler(fileHandler)
logger.setLevel(logging.WARN)

import logging
import tempfile

logger = logging.getLogger("LanguageClient")
with tempfile.NamedTemporaryFile(
        prefix="LanguageClient-",
        suffix=".log", delete=False) as tmp:
    tmpname = tmp.name
fileHandler = logging.FileHandler(filename=tmpname)
fileHandler.setFormatter(
    logging.Formatter(
        "%(asctime)s %(levelname)-8s %(message)s",
        "%H:%M:%S"))
logger.addHandler(fileHandler)
logger.setLevel(logging.WARN)

Use tempfile lib for log file
Use tempfile lib for log file

The fixed name for the log file causes issues for multiple users.  The
tempfile library will create temporary files that don't conflict.

  import logging
+ import tempfile
  
  logger = logging.getLogger("LanguageClient")
+ with tempfile.NamedTemporaryFile(
+         prefix="LanguageClient-",
+         suffix=".log", delete=False) as tmp:
+     tmpname = tmp.name
- fileHandler = logging.FileHandler(filename="/tmp/LanguageClient.log")
+ fileHandler = logging.FileHandler(filename=tmpname)
  fileHandler.setFormatter(
      logging.Formatter(
          "%(asctime)s %(levelname)-8s %(message)s",
          "%H:%M:%S"))
  logger.addHandler(fileHandler)
  logger.setLevel(logging.WARN)
  
Use tempfile lib for log file
## Code Before:
import logging

logger = logging.getLogger("LanguageClient")
fileHandler = logging.FileHandler(filename="/tmp/LanguageClient.log")
fileHandler.setFormatter(
    logging.Formatter(
        "%(asctime)s %(levelname)-8s %(message)s",
        "%H:%M:%S"))
logger.addHandler(fileHandler)
logger.setLevel(logging.WARN)

## Instruction:
Use tempfile lib for log file
## Code After:
import logging
import tempfile

logger = logging.getLogger("LanguageClient")
with tempfile.NamedTemporaryFile(
        prefix="LanguageClient-",
        suffix=".log", delete=False) as tmp:
    tmpname = tmp.name
fileHandler = logging.FileHandler(filename=tmpname)
fileHandler.setFormatter(
    logging.Formatter(
        "%(asctime)s %(levelname)-8s %(message)s",
        "%H:%M:%S"))
logger.addHandler(fileHandler)
logger.setLevel(logging.WARN)
