code: def update(self, event, instance):
      if event == Events.OPTIMIZATION_STEP:
          data = dict(instance.res[-1])
  
          now, time_elapsed, time_delta = self._time_metrics()
          data["datetime"] = {
              "datetime": now,
              "elapsed": time_elapsed,
              "delta": time_delta,
          }
  
          if (
              "allowed" in data
          ):  # fix: github.com/fmfn/BayesianOptimization/issues/361
              data["allowed"] = bool(data["allowed"])
  
          with open(self._path, "a") as f:
              f.write(json.dumps(data) + "\n")
  
      self._update_tracker(event, instance)
  
imports: from __future__ import print_function
  import os
  import json
  import warnings
  from pathlib import Path
  from .observer import _Tracker
  from .event import Events
  from .util import Colours
label_desc: Use image node_id 2 for calling the JSONLogger obj's underlying member method code with example usage: obj.update(event, instance) without return types