Exports log [[messages]] to a specific destination.
Child classes must implement this method.
336471
public function export()
    {
        foreach ($this->messages as $message) {
            list($context, $level, $category, $timestamp, $traces) = $message;

            $data = [
                'level' => static::getLevelName($level),
                'timestamp' => $timestamp,
                'tags' => [
                    'category' => $category,
                ],
            ];

            if ($context instanceof \Throwable || $context instanceof \Exception) {
                $this->sentry->captureException($context, $data);
                continue;
            } elseif (isset($context['msg'])) {
                $data['message'] = $context['msg'];
                $extra = $context;
                unset($extra['msg']);
                $data['extra'] = $extra;
            } else {
                // If the message is not a string, log it with VarDumper::export,
                // like the other log targets in Yii.
                $data['message'] = is_string($context) ? $context : VarDumper::export($context);
                if (is_array($context)) {
                    // But if it's an array, also send it as an array,
                    // so that it can be displayed nicely in Sentry.
                    $data['extra'] = $context;
                }
            }

            $this->sentry->capture($data, $traces);
        }
    }
1338429
def _log_send(self, logrecord):
        """"""
        for field, value in self.__log_extensions:
            setattr(logrecord, field, value)
        self.__send_to_frontend({"band": "log", "payload": logrecord})
211737
function OutgoingMessage() {
  // * This is basically a read-only wrapper for the [Stream](protocol/stream.html) class.
  Writable.call(this);

  this._headers = {};
  this._trailers = undefined;
  this.headersSent = false;
  this.finished = false;

  this.on('finish', this._finish);
}
51531
public static void serializeTo( Destination destination , RawDataBuffer out )
    {
    	try
    	{
    		if (destination == null)
    		{
    			out.writeByte(NO_DESTINATION);
    		}
    		else
	        if (destination instanceof Queue)
	        {
	            out.writeByte(TYPE_QUEUE);
	            out.writeUTF(((Queue)destination).getQueueName());
	        }
	        else
            if (destination instanceof Topic)
            {
            	out.writeByte(TYPE_TOPIC);
                out.writeUTF(((Topic)destination).getTopicName());
            }
            else
                throw new IllegalArgumentException("Unsupported destination : "+destination);
    	}
    	catch (JMSException e)
    	{
    		throw new IllegalArgumentException("Cannot serialize destination : "+e.getMessage());
    	}
    }
1041334
public static Log replay(Log source, Class<?> destination) {
		return replay(source, LogFactory.getLog(destination));
	}
694347
function messageLog(...messages) {
      if (active) {
        const protectedMessage = messageArrayProtect(messages)
        levelLogger(tag, ...protectedMessage)
      }
      return messages[0]
    }
1360162
private void sendMessageToLogger(Level level, String message, Log log, Throwable e) {

        if (e == null) {
            if (level == Level.SEVERE) {
                log.error(message);
            } else if (level == Level.WARNING) {
                log.warn(message);
            } else if (level == Level.INFO) {
                log.info(message);
            } else if (level == Level.CONFIG) {
                log.info(message);
            } else if ((level == Level.FINE) || (level == Level.FINER) || (level == Level.FINEST)) {
                log.debug(message);
            } else {
                log.info(message);
            }
        } else {
            if (level == Level.SEVERE) {
                log.error(message, e);
            } else if (level == Level.WARNING) {
                log.warn(message, e);
            } else if (level == Level.INFO) {
                log.info(message, e);
            } else if (level == Level.CONFIG) {
                log.info(message, e);
            } else if ((level == Level.FINE) || (level == Level.FINER) || (level == Level.FINEST)) {
                log.debug(message, e);
            } else {
                log.info(message, e);
            }
        }
    }
1363048
def msg(message, *args, **kwargs):
    """"""
    global log_file
    if log_file is None:
        log_file = sys.stderr
    if long_msg:
        file_name, line = caller_trace()
        file_name, file_type = os.path.splitext(file_name)
        if file_name.endswith('/__init__'):
            file_name = os.path.basename(os.path.dirname(file_name))
        elif file_name.endswith('/__main__'):
            file_name = "(-m) {0}".format(
                os.path.basename(os.path.dirname(file_name)))
        else:
            file_name = os.path.basename(file_name)
        head = '{0}{1} ({2}): '.format(file_name, file_type, line)
    else:
        head = '[SERVER] '
    out = StringIO()
    for line in message.format(*args, **kwargs).split('\n'):
        out.write('{0}{1}\n'.format(head, line))
    out.flush()
    out.seek(0)
    if _msg_stderr:
        sys.stderr.write(out.read())
        sys.stderr.flush()
    else:
        log_file.write(out.read())
        log_file.flush()
    out.close()
901965
def log_to_file(self, message):
        """"""

        with self.build_fs.open(self.log_file, 'a+') as f:
            f.write(unicode(message + '\n'))
424239
def on_receive(self, message):
        
        if self.log_file is not None and message['should_log']:
            message_copy = Message(message['text'],
                                   Metadata(None).__dict__,
                                   message['should_log']).__dict__
            with open(self.log_file, mode='w') as f:
                f.write(json.dumps(message_copy))
            logger.info(message['metadata']['source'])
        if self.listening_for(message):
            self_thread = self.HandlerThread(self.handle, message)
            self_thread.start()
        self.cleanup()
        for child in self.children:
            child.tell(message)
1092072
function(message) {
    if (!_.isObject(message)) {
      message = {
        message: message
      };
    }

    try {
      message = JSON.stringify(_.defaultsDeep({}, message, this.config.defaultProps));
    } catch (e) {
      return this.logger.error('Logmatic - error while parsing log message. Not sending', e);
    }

    if (this.isConnected) {
      this.sendMessage(message);
    } else {
      this.messageBuffer.push(message);
    }
  }
36664
@Override
  public void logMessage(LogLevel logLevel, String message, Class clazz, String methodName) {
    Logger logger = Logger.getLogger(clazz.getName());
    logger.logp(convertToJDK14Level(logLevel), clazz.getName(), methodName, message);
  }
680011
protected void routeTo(String msg, LogRecord logRecord, String logHandlerId) {
        LogHandler logHandler = logHandlerServices.get(logHandlerId);
        if (logHandler != null) {
            logHandler.publish(msg, logRecord);
        }
    }
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);
    }
  }
1290362
def position_messages_from_tlog(filename):
    
    # Pull out just the global position msgs
    messages = []
    mlog = mavutil.mavlink_connection(filename)
    while True:
        try:
            m = mlog.recv_match(type=['GLOBAL_POSITION_INT'])
            if m is None:
                break
        except Exception:
            break
        # ignore we get where there is no fix:
        if m.lat == 0:
            continue
        messages.append(m)

    # Shrink the number of points for readability and to stay within autopilot memory limits. 
    # For coding simplicity we:
    #   - only keep points that are with 3 metres of the previous kept point.
    #   - only keep the first 100 points that meet the above criteria.
    num_points = len(messages)
    keep_point_distance=3 #metres
    kept_messages = []
    kept_messages.append(messages[0]) #Keep the first message
    pt1num=0
    pt2num=1
    while True:
        #Keep the last point. Only record 99 points.
        if pt2num==num_points-1 or len(kept_messages)==99:
            kept_messages.append(messages[pt2num])
            break
        pt1 = LocationGlobalRelative(messages[pt1num].lat/1.0e7,messages[pt1num].lon/1.0e7,0)
        pt2 = LocationGlobalRelative(messages[pt2num].lat/1.0e7,messages[pt2num].lon/1.0e7,0)
        distance_between_points = get_distance_metres(pt1,pt2)
        if distance_between_points > keep_point_distance:
            kept_messages.append(messages[pt2num])
            pt1num=pt2num
        pt2num=pt2num+1

    return kept_messages
870755
function fetchLogs(root, msg, callback) {
    const number = msg.number;
    const logfile = msg.logfile;
    const serverId = msg.serverId;
    const filePath = path.join(root, getLogFileName(logfile, serverId));

    const endLogs = [];
    exec(`tail -n ${number} ${filePath}`, (error, output) => {
        const endOut = [];
        output = output.replace(/^\s+|\s+$/g, '').split(/\s+/);

        for (let i = 5; i < output.length; i += 6) {
            endOut.push(output[i]);
        }

        const endLength = endOut.length;
        for (let j = 0; j < endLength; j++) {
            const map = {};
            let json;
            try {
                json = JSON.parse(endOut[j]);
            } catch (e) {
                logger.error(`the log cannot parsed to json, ${e}`);
                continue;   // eslint-disable-line
            }
            map.time = json.time;
            map.route = json.route || json.service;
            map.serverId = serverId;
            map.timeUsed = json.timeUsed;
            map.params = endOut[j];
            endLogs.push(map);
        }

        callback({ logfile: logfile, dataArray: endLogs });
    });
}
307152
public synchronized void backupTrxLog(Object objMessage)
    {
        try {
            this.getWriter().writeObject(objMessage);
            m_lastWrite = System.currentTimeMillis();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }