code: def emit(self, record):
      log_entry = {}
      log_entry["tag"] = self.tag
      log_entry["stdOutputType"] = self.std_output_type.name
      log_entry["msg"] = self.format(record)
  
      try:
          if self.channel is None:
              rest_post(
                  gen_send_stdout_url(self.host, self.port),
                  json.dumps(log_entry),
                  10,
                  True,
              )
          else:
              if self.trial_id is not None:
                  log_entry["trial"] = self.trial_id
              self.channel.send(CommandType.StdOut, log_entry)
      except Exception as e:
          self.orig_stderr.write(str(e) + "\n")
          self.orig_stderr.flush()
  
imports: import os
  import sys
  import json
  import logging
  import logging.handlers
  import time
  import threading
  import re
  from datetime import datetime
  from enum import Enum, unique
  from logging import StreamHandler
  from queue import Queue
  from .rest_utils import rest_post
  from .url_utils import gen_send_stdout_url
  from .commands import CommandType
label_desc: Use image node_id 2 for calling the NNIRestLogHanlder obj's underlying member method code with example usage: obj.emit(record) without return types