Add a message to the log file.

        :param str message: an arbitrary message
        :param float timestamp: the absolute timestamp of the event
547866
def log_event(self, message, timestamp=None):
        

        if not message: # if empty or None
            logger.debug("ASCWriter: ignoring empty message")
            return

        # this is the case for the very first message:
        if not self.header_written:
            self.last_timestamp = (timestamp or 0.0)
            self.started = self.last_timestamp
            mlsec = repr(self.last_timestamp).split('.')[1][:3]
            formatted_date = time.strftime(self.FORMAT_DATE.format(mlsec), time.localtime(self.last_timestamp))
            self.file.write("Begin Triggerblock %s\n" % formatted_date)
            self.header_written = True
            self.log_event("Start of measurement") # caution: this is a recursive call!

        # Use last known timestamp if unknown
        if timestamp is None:
            timestamp = self.last_timestamp

        # turn into relative timestamps if necessary
        if timestamp >= self.started:
            timestamp -= self.started

        line = self.FORMAT_EVENT.format(timestamp=timestamp, message=message)
        self.file.write(line)
214600
def add_console_message(self, message_type, message):
        
        for m in message.split("\n"):
            if m.strip():
                self.console_messages.append((message_type, m))
121223
function(targetLevelObject, message, messageArgs)
  {
    // the message should not be logged if the target
    // level is more verbose than the current level
    if (targetLevelObject.level <= currlevelObject.level)
    {
      // substitute the messageArgs into the message template
      messageArgs.unshift(message);
      message = Util.format.apply(Util, messageArgs);

      // truncate the message if it's too long
      if (message.length > messageMaxLength)
      {
        message = message.slice(0, messageMaxLength);
      }

      // if needed, add the current time to the front of the message
      if (includeTimestamp)
      {
        message = Util.format(
            '[%s]: %s', moment().format('h:mm:ss.ms A'), message);
      }

      // log the message
      logMessage(targetLevelObject.tag, message, bufferMaxLength);
    }
  }
1264757
def post_message(self, msg):
        ''''''
        # read the timestamp
        super(mavlogfile, self).post_message(msg)
        if self.planner_format:
            self.f.read(1) # trailing newline
        self.timestamp = msg._timestamp
        self._last_message = msg
        if msg.get_type() != "BAD_DATA":
            self._last_timestamp = msg._timestamp
        msg._link = self._link
1144289
def __load_dump(self, message):
        
        dump = message.content
        if self._hook is not None:
            # Call the hook
            try:
                updated_dump = self._hook(message, dump)
                if updated_dump is not None:
                    # Use the new description
                    dump = updated_dump
            except (TypeError, ValueError) as ex:
                self._logger("Invalid description hook: %s", ex)
        return dump
1041192
def log_message(self, msg, *args):
        """"""
        if args:
            msg = msg % args
        self.logger.info(msg)
232515
def add_message(message, info: nil)
      self.last_message = message
      self.last_info = info
      self.last_item = Item.new(message, info)

      # add to each recording group
      recording_groups.each do |group|
        group << Item.new(message, info)
      end

      @uniq_trace_streams.each do |stream|
        stream.puts message
      end

      return self
    end
510315
function(message) {
        if (!this._tickList) {
            this._tickList = [];
            while (this._tickList.length < this._maxTicks) {
                this._tickList.push(0);
            }
        }

        if (!this._lastHeart) {
            this._lastHeart = Date.now();
            this._lastFpsUpdate = this._lastHeart;
            return;
        }

        var newHeart = Date.now();
        var newTick = newHeart - this._lastHeart;
        this._lastHeart = newHeart;

        this._tickSum -= this._tickList[this._tickIndex];
        this._tickSum += newTick;
        this._tickList[this._tickIndex] = newTick;
        if (++this._tickIndex == this._maxTicks) {
            this._tickIndex = 0;
        }
    }
785765
def lraise(self,message):
        
        s = str(datetime.now()) + " ERROR: " + message + '\n'
        print(s,end='')
        if self.filename:
            self.f.write(s)
            self.f.flush
            self.f.close()
        raise Exception(message)
330632
def log_message(self, format, *args):
        
        clock_start = getattr(thread_local, 'clock_start', None)
        thread_local.clock_start = None
        timing = self.log_elapsed_time_string(
            get_time() - clock_start) if clock_start is not None else ''
        msg("%s[%s] %s" % (
            timing + ' ' if len(timing) else '', self.log_date_time_string(),
            format % args))
583324
def write_message(self, message):
        
        logging.debug("Sending message {mes} to {usr}".format(mes=message, usr=self.id))
        self.handler.write_message(message)
106872
async def message_field(self, msg, field, fvalue=None, obj=None):
        
        fname, ftype, params = field[0], field[1], field[2:]
        try:
            self.tracker.push_field(fname)
            if self.writing:
                fvalue = getattr(msg, fname, None) if fvalue is None else fvalue
                await self._dump_field(fvalue, ftype, params)

            else:
                await self._load_field(ftype, params, x.eref(msg, fname))

            self.tracker.pop()

        except Exception as e:
            raise helpers.ArchiveException(e, tracker=self.tracker) from e
1183877
def write_log(self, message):
        
        if self._is_write_log and self.log_file and not self.log_file.closed:
            self.log_file.write(message + '\n')
1301207
def format_log(request, message_type, message):
    
    from django_socketio.settings import MESSAGE_LOG_FORMAT
    if MESSAGE_LOG_FORMAT is None:
        return None
    now = datetime.now().replace(microsecond=0)
    args = dict(request.META, TYPE=message_type, MESSAGE=message, TIME=now)
    return (MESSAGE_LOG_FORMAT % args) + "\n"
454476
def _write_log(self, log_type, log_time, message):
        
        timestamp = datetime.datetime.now().strftime(" %Y-%m-%d %H:%M:%S")
        log_entry = "[{}{}] {}".format(log_type, timestamp if log_time else "", message)
        if self._logger and callable(getattr(self._logger, self._logger_methods[log_type], None)):
            # Check for log handler (sends message only if _logger_no_prefix is True)
            getattr(
                self._logger,
                self._logger_methods[log_type],
                None
                )(message if self._logger_no_prefix else log_entry)
        elif self._log_file:
            # Otherwise write to file, if a file has been specified
            with open(self._log_file, 'a') as logfile:
                try:
                    logfile.write(unicode(log_entry + "\n"))
                except NameError: # `unicode` only works in Python 2
                    logfile.write(log_entry + "\n")
        else:
            # Otherwise, print to STDOUT
            print(log_entry)
199201
protected void addMessage(String message)
    {
        messages.add(message);
        messageCount++;
        if (messageCount > messagesQueueMax)
        {
            messages.remove();
            messageCount--;
        }
    }
1169411
def _add_log_file(filename):
    """"""
    handler = logging.FileHandler(filename)

    handler.setLevel(logging.DEBUG)
    formatter = _Formatter(fmt=_logger_fmt,
                           datefmt='%Y-%m-%d %H:%M:%S')
    handler.setFormatter(formatter)
    logging.getLogger().addHandler(handler)