prompt: You will be provided with a partial code base and an issue statement explaining a problem to resolve.
  <issue>
  Missing sys module import in logger.py
  Logger module is missing an import statement for 'sys'
  
  </issue>
  <code>
  [start of turbinia/config/logger.py]
  1 # -*- coding: utf-8 -*-
  2 # Copyright 2017 Google Inc.
  3 #
  4 # Licensed under the Apache License, Version 2.0 (the "License");
  5 # you may not use this file except in compliance with the License.
  6 # You may obtain a copy of the License at
  7 #
  8 #      http://www.apache.org/licenses/LICENSE-2.0
  9 #
  10 # Unless required by applicable law or agreed to in writing, software
  11 # distributed under the License is distributed on an "AS IS" BASIS,
  12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 # See the License for the specific language governing permissions and
  14 # limitations under the License.
  15 """Sets up logging."""
  16 
  17 from __future__ import unicode_literals
  18 import logging
  19 
  20 import warnings
  21 import logging.handlers
  22 import os
  23 
  24 from turbinia import config
  25 from turbinia import TurbiniaException
  26 
  27 # Environment variable to look for node name in
  28 ENVNODENAME = 'NODE_NAME'
  29 
  30 
  31 def setup(need_file_handler=True, need_stream_handler=True, log_file_path=None):
  32   """Set up logging parameters.
  33 
  34   This will also set the root logger, which is the default logger when a named
  35   logger is not specified.  We currently use 'turbinia' as the named logger,
  36   however some external modules that are called by Turbinia can use the root
  37   logger, so we want to be able to optionally configure that as well.
  38   """
  39   # Remove known warning about credentials
  40   warnings.filterwarnings(
  41       'ignore', 'Your application has authenticated using end user credentials')
  42 
  43   logger = logging.getLogger('turbinia')
  44   # Eliminate double logging from root logger
  45   logger.propagate = False
  46 
  47   # We only need a handler if one of that type doesn't exist already
  48   if logger.handlers:
  49     for handler in logger.handlers:
  50       # Want to do strict type-checking here because is instance will include
  51       # subclasses and so won't distinguish between StreamHandlers and
  52       # FileHandlers.
  53       # pylint: disable=unidiomatic-typecheck
  54       if type(handler) == logging.FileHandler:
  55         need_file_handler = False
  56 
  57       # pylint: disable=unidiomatic-typecheck
  58       if type(handler) == logging.StreamHandler:
  59         need_stream_handler = False
  60 
  61   if need_file_handler:
  62     try:
  63       config.LoadConfig()
  64     except TurbiniaException as exception:
  65       print(
  66           'Could not load config file ({0!s}).\n{1:s}'.format(
  67               exception, config.CONFIG_MSG))
  68       sys.exit(1)
  69 
  70     # Check if a user specified log path was provided else create default path
  71     if not log_file_path:
  72       log_name = os.uname().nodename
  73       # Check if NODE_NAME available for GKE setups
  74       if ENVNODENAME in os.environ:
  75         log_name = log_name + '.{0!s}'.format(os.environ[ENVNODENAME])
  76       log_file_path = os.path.join(config.LOG_DIR, log_name) + '.log'
  77 
  78     file_handler = logging.FileHandler(log_file_path)
  79     formatter = logging.Formatter('%(asctime)s:%(levelname)s:%(message)s')
  80     file_handler.setFormatter(formatter)
  81     file_handler.setLevel(logging.DEBUG)
  82     logger.addHandler(file_handler)
  83 
  84   console_handler = logging.StreamHandler()
  85   formatter = logging.Formatter(
  86       '%(asctime)s [%(levelname)s] %(message)s', "%Y-%m-%d %H:%M:%S")
  87   console_handler.setFormatter(formatter)
  88   if need_stream_handler:
  89     logger.addHandler(console_handler)
  90 
  91   # Configure the root logger to use exactly our handlers because other modules
  92   # like PSQ use this, and we want to see log messages from it when executing
  93   # from CLI.
  94   root_log = logging.getLogger()
  95   for handler in root_log.handlers:
  96     root_log.removeHandler(handler)
  97   root_log.addHandler(console_handler)
  98   if need_file_handler:
  99     root_log.addHandler(file_handler)
  100 
  101   # Set filelock logging to ERROR due to log spam
  102   logging.getLogger("filelock").setLevel(logging.ERROR)
  103
  [end of turbinia/config/logger.py]
  </code>
  
  I need you to solve this issue by generating a single patch file that I can apply directly to this repository using git apply. Please respond with a single patch file in the following format.
  <patch>
  diff --git a/file.py b/file.py
  --- a/file.py
  +++ b/file.py
  @@ -1,27 +1,35 @@
   def euclidean(a, b):
  -    while b:
  -        a, b = b, a % b
  -    return a
  +    if b == 0:
  +        return a
  +    return euclidean(b, a % b)
   
   
   def bresenham(x0, y0, x1, y1):
       points = []
       dx = abs(x1 - x0)
       dy = abs(y1 - y0)
  -    sx = 1 if x0 < x1 else -1
  -    sy = 1 if y0 < y1 else -1
  -    err = dx - dy
  +    x, y = x0, y0
  +    sx = -1 if x0 > x1 else 1
  +    sy = -1 if y0 > y1 else 1
   
  -    while True:
  -        points.append((x0, y0))
  -        if x0 == x1 and y0 == y1:
  -            break
  -        e2 = 2 * err
  -        if e2 > -dy:
  -            err -= dy
  -            x0 += sx
  -        if e2 < dx:
  -            err += dx
  -            y0 += sy
  +    if dx > dy:
  +        err = dx / 2.0
  +        while x != x1:
  +            points.append((x, y))
  +            err -= dy
  +            if err < 0:
  +                y += sy
  +                err += dx
  +            x += sx
  +    else:
  +        err = dy / 2.0
  +        while y != y1:
  +            points.append((x, y))
  +            err -= dx
  +            if err < 0:
  +                x += sx
  +                err += dy
  +            y += sy
  +
  +    points.append((x, y))
       return points
  
  </patch>
golden_diff: diff --git a/turbinia/config/logger.py b/turbinia/config/logger.py
  --- a/turbinia/config/logger.py
  +++ b/turbinia/config/logger.py
  @@ -20,6 +20,7 @@
   import warnings
   import logging.handlers
   import os
  +import sys
   
   from turbinia import config
   from turbinia import TurbiniaException
  
verification_info: {"golden_diff": "diff --git a/turbinia/config/logger.py b/turbinia/config/logger.py\n--- a/turbinia/config/logger.py\n+++ b/turbinia/config/logger.py\n@@ -20,6 +20,7 @@\n import warnings\n import logging.handlers\n import os\n+import sys\n \n from turbinia import config\n from turbinia import TurbiniaException\n", "issue": "Missing sys module import in logger.py\nLogger module is missing an import statement for 'sys'\n", "before_files": [{"content": "# -*- coding: utf-8 -*-\n# Copyright 2017 Google Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n#      http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\"\"\"Sets up logging.\"\"\"\n\nfrom __future__ import unicode_literals\nimport logging\n\nimport warnings\nimport logging.handlers\nimport os\n\nfrom turbinia import config\nfrom turbinia import TurbiniaException\n\n# Environment variable to look for node name in\nENVNODENAME = 'NODE_NAME'\n\n\ndef setup(need_file_handler=True, need_stream_handler=True, log_file_path=None):\n  \"\"\"Set up logging parameters.\n\n  This will also set the root logger, which is the default logger when a named\n  logger is not specified.  We currently use 'turbinia' as the named logger,\n  however some external modules that are called by Turbinia can use the root\n  logger, so we want to be able to optionally configure that as well.\n  \"\"\"\n  # Remove known warning about credentials\n  warnings.filterwarnings(\n      'ignore', 'Your application has authenticated using end user credentials')\n\n  logger = logging.getLogger('turbinia')\n  # Eliminate double logging from root logger\n  logger.propagate = False\n\n  # We only need a handler if one of that type doesn't exist already\n  if logger.handlers:\n    for handler in logger.handlers:\n      # Want to do strict type-checking here because is instance will include\n      # subclasses and so won't distinguish between StreamHandlers and\n      # FileHandlers.\n      # pylint: disable=unidiomatic-typecheck\n      if type(handler) == logging.FileHandler:\n        need_file_handler = False\n\n      # pylint: disable=unidiomatic-typecheck\n      if type(handler) == logging.StreamHandler:\n        need_stream_handler = False\n\n  if need_file_handler:\n    try:\n      config.LoadConfig()\n    except TurbiniaException as exception:\n      print(\n          'Could not load config file ({0!s}).\\n{1:s}'.format(\n              exception, config.CONFIG_MSG))\n      sys.exit(1)\n\n    # Check if a user specified log path was provided else create default path\n    if not log_file_path:\n      log_name = os.uname().nodename\n      # Check if NODE_NAME available for GKE setups\n      if ENVNODENAME in os.environ:\n        log_name = log_name + '.{0!s}'.format(os.environ[ENVNODENAME])\n      log_file_path = os.path.join(config.LOG_DIR, log_name) + '.log'\n\n    file_handler = logging.FileHandler(log_file_path)\n    formatter = logging.Formatter('%(asctime)s:%(levelname)s:%(message)s')\n    file_handler.setFormatter(formatter)\n    file_handler.setLevel(logging.DEBUG)\n    logger.addHandler(file_handler)\n\n  console_handler = logging.StreamHandler()\n  formatter = logging.Formatter(\n      '%(asctime)s [%(levelname)s] %(message)s', \"%Y-%m-%d %H:%M:%S\")\n  console_handler.setFormatter(formatter)\n  if need_stream_handler:\n    logger.addHandler(console_handler)\n\n  # Configure the root logger to use exactly our handlers because other modules\n  # like PSQ use this, and we want to see log messages from it when executing\n  # from CLI.\n  root_log = logging.getLogger()\n  for handler in root_log.handlers:\n    root_log.removeHandler(handler)\n  root_log.addHandler(console_handler)\n  if need_file_handler:\n    root_log.addHandler(file_handler)\n\n  # Set filelock logging to ERROR due to log spam\n  logging.getLogger(\"filelock\").setLevel(logging.ERROR)\n", "path": "turbinia/config/logger.py"}]}