prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  [FollowPath] position_update log frequency
  position_update log entries for FollowPath appear too often, like every 1.5 seconds, with distance changes from 1 meter to 5 meter depend on the random speed. It's kind of unnecessarily spam the terminal.
  
  An interval of 5 seconds or 10 meter should be more relevant.
  
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `pokemongo_bot/base_task.py`
  Content:
  ```
  1 import logging
  2 
  3 
  4 class BaseTask(object):
  5   TASK_API_VERSION = 1
  6 
  7   def __init__(self, bot, config):
  8     """
  9 
  10     :param bot:
  11     :type bot: pokemongo_bot.PokemonGoBot
  12     :param config:
  13     :return:
  14     """
  15     self.bot = bot
  16     self.config = config
  17     self._validate_work_exists()
  18     self.logger = logging.getLogger(type(self).__name__)
  19     self.enabled = config.get('enabled', True)
  20     self.initialize()
  21 
  22   def _validate_work_exists(self):
  23     method = getattr(self, 'work', None)
  24     if not method or not callable(method):
  25       raise NotImplementedError('Missing "work" method')
  26 
  27   def emit_event(self, event, sender=None, level='info', formatted='', data={}):
  28     if not sender:
  29       sender=self
  30     self.bot.event_manager.emit(
  31       event,
  32       sender=sender,
  33       level=level,
  34       formatted=formatted,
  35       data=data
  36     )
  37 
  38   def initialize(self):
  39     pass
  40
  ```
  --- 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/pokemongo_bot/base_task.py b/pokemongo_bot/base_task.py
  --- a/pokemongo_bot/base_task.py
  +++ b/pokemongo_bot/base_task.py
  @@ -1,5 +1,7 @@
   import logging
   
  +import time
  +
   
   class BaseTask(object):
     TASK_API_VERSION = 1
  @@ -17,6 +19,7 @@
       self._validate_work_exists()
       self.logger = logging.getLogger(type(self).__name__)
       self.enabled = config.get('enabled', True)
  +    self.last_log_time = time.time()
       self.initialize()
   
     def _validate_work_exists(self):
  @@ -27,13 +30,17 @@
     def emit_event(self, event, sender=None, level='info', formatted='', data={}):
       if not sender:
         sender=self
  -    self.bot.event_manager.emit(
  -      event,
  -      sender=sender,
  -      level=level,
  -      formatted=formatted,
  -      data=data
  -    )
  +
  +    # Print log only if X seconds are passed from last log
  +    if (time.time() - self.last_log_time) > self.config.get('log_interval', 0):
  +      self.last_log_time = time.time()
  +      self.bot.event_manager.emit(
  +        event,
  +        sender=sender,
  +        level=level,
  +        formatted=formatted,
  +        data=data
  +      )
   
     def initialize(self):
       pass
  
verification_info: {"golden_diff": "diff --git a/pokemongo_bot/base_task.py b/pokemongo_bot/base_task.py\n--- a/pokemongo_bot/base_task.py\n+++ b/pokemongo_bot/base_task.py\n@@ -1,5 +1,7 @@\n import logging\n \n+import time\n+\n \n class BaseTask(object):\n   TASK_API_VERSION = 1\n@@ -17,6 +19,7 @@\n     self._validate_work_exists()\n     self.logger = logging.getLogger(type(self).__name__)\n     self.enabled = config.get('enabled', True)\n+    self.last_log_time = time.time()\n     self.initialize()\n \n   def _validate_work_exists(self):\n@@ -27,13 +30,17 @@\n   def emit_event(self, event, sender=None, level='info', formatted='', data={}):\n     if not sender:\n       sender=self\n-    self.bot.event_manager.emit(\n-      event,\n-      sender=sender,\n-      level=level,\n-      formatted=formatted,\n-      data=data\n-    )\n+\n+    # Print log only if X seconds are passed from last log\n+    if (time.time() - self.last_log_time) > self.config.get('log_interval', 0):\n+      self.last_log_time = time.time()\n+      self.bot.event_manager.emit(\n+        event,\n+        sender=sender,\n+        level=level,\n+        formatted=formatted,\n+        data=data\n+      )\n \n   def initialize(self):\n     pass\n", "issue": "[FollowPath] position_update log frequency\nposition_update log entries for FollowPath appear too often, like every 1.5 seconds, with distance changes from 1 meter to 5 meter depend on the random speed. It's kind of unnecessarily spam the terminal.\n\nAn interval of 5 seconds or 10 meter should be more relevant.\n\n", "before_files": [{"content": "import logging\n\n\nclass BaseTask(object):\n  TASK_API_VERSION = 1\n\n  def __init__(self, bot, config):\n    \"\"\"\n\n    :param bot:\n    :type bot: pokemongo_bot.PokemonGoBot\n    :param config:\n    :return:\n    \"\"\"\n    self.bot = bot\n    self.config = config\n    self._validate_work_exists()\n    self.logger = logging.getLogger(type(self).__name__)\n    self.enabled = config.get('enabled', True)\n    self.initialize()\n\n  def _validate_work_exists(self):\n    method = getattr(self, 'work', None)\n    if not method or not callable(method):\n      raise NotImplementedError('Missing \"work\" method')\n\n  def emit_event(self, event, sender=None, level='info', formatted='', data={}):\n    if not sender:\n      sender=self\n    self.bot.event_manager.emit(\n      event,\n      sender=sender,\n      level=level,\n      formatted=formatted,\n      data=data\n    )\n\n  def initialize(self):\n    pass\n", "path": "pokemongo_bot/base_task.py"}], "after_files": [{"content": "import logging\n\nimport time\n\n\nclass BaseTask(object):\n  TASK_API_VERSION = 1\n\n  def __init__(self, bot, config):\n    \"\"\"\n\n    :param bot:\n    :type bot: pokemongo_bot.PokemonGoBot\n    :param config:\n    :return:\n    \"\"\"\n    self.bot = bot\n    self.config = config\n    self._validate_work_exists()\n    self.logger = logging.getLogger(type(self).__name__)\n    self.enabled = config.get('enabled', True)\n    self.last_log_time = time.time()\n    self.initialize()\n\n  def _validate_work_exists(self):\n    method = getattr(self, 'work', None)\n    if not method or not callable(method):\n      raise NotImplementedError('Missing \"work\" method')\n\n  def emit_event(self, event, sender=None, level='info', formatted='', data={}):\n    if not sender:\n      sender=self\n\n    # Print log only if X seconds are passed from last log\n    if (time.time() - self.last_log_time) > self.config.get('log_interval', 0):\n      self.last_log_time = time.time()\n      self.bot.event_manager.emit(\n        event,\n        sender=sender,\n        level=level,\n        formatted=formatted,\n        data=data\n      )\n\n  def initialize(self):\n    pass\n", "path": "pokemongo_bot/base_task.py"}]}