code: def add(message, level=0, user=None, message_short=None,log_file_name='%s/pyscada_daemon.log' % settings.BASE_DIR,):
      
      #if not access(path.dirname(self.log_file_name), W_OK):
      #    self.stderr.write("logfile path is not writeable\n")
      #    sys.exit(0)
      #if access(self.log_file_name, F_OK) and not access(self.log_file_name, W_OK):
      #    self.stderr.write("logfile is not writeable\n")
      #    sys.exit(0)
  
      if message_short is None:
          message_len = len(message)
          if message_len > 35:
              message_short = message[0:31] + '...'
          else:
              message_short = message
  
      #log_ob = Log(message=message, level=level, message_short=message_short, timestamp=time())
      #if user:
      #    log_ob.user = user
      #log_ob.save()
      stdout = open(log_file_name, "a+")
      stdout.write("%s (%s,%d):%s\n" % (datetime.now().isoformat(' '),'none',level,message))
      stdout.flush()
docs: add a new massage/error notice to the log
      <0 - Debug
      1 - Emergency
      2 - Critical
      3 - Errors
      4 - Alerts
      5 - Warnings
      6 - Notification (webnotice)
      7 - Information (webinfo)
      8 - Notification (notice)
      9 - Information (info)