当前位置: 首页>>代码示例>>Golang>>正文


Golang Message.GetLogMessage方法代码示例

本文整理汇总了Golang中github.com/cloudfoundry/loggregatorlib/logmessage.Message.GetLogMessage方法的典型用法代码示例。如果您正苦于以下问题:Golang Message.GetLogMessage方法的具体用法?Golang Message.GetLogMessage怎么用?Golang Message.GetLogMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/cloudfoundry/loggregatorlib/logmessage.Message的用法示例。


在下文中一共展示了Message.GetLogMessage方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: logMessageOutput

func logMessageOutput(msg *logmessage.Message) string {
	logHeader, coloredLogHeader := extractLogHeader(msg)
	logMsg := msg.GetLogMessage()
	logContent := extractLogContent(logMsg, logHeader)

	return fmt.Sprintf("%s%s", coloredLogHeader, logContent)
}
开发者ID:jalateras,项目名称:cli,代码行数:7,代码来源:helpers.go

示例2: extractLogHeader

func extractLogHeader(msg *logmessage.Message) (logHeader, coloredLogHeader string) {
	logMsg := msg.GetLogMessage()
	sourceType := msg.GetShortSourceTypeName()
	sourceId := logMsg.GetSourceId()
	t := time.Unix(0, logMsg.GetTimestamp())
	timeFormat := TIMESTAMP_FORMAT
	timeString := t.Format(timeFormat)

	logHeader = fmt.Sprintf("%s [%s]", timeString, sourceType)
	coloredLogHeader = terminal.LogSysHeaderColor(logHeader)

	if logMsg.GetSourceType() == logmessage.LogMessage_WARDEN_CONTAINER {
		logHeader = fmt.Sprintf("%s [%s/%s]", timeString, sourceType, sourceId)
		coloredLogHeader = terminal.LogAppHeaderColor(logHeader)
	}

	// Calculate padding
	longestHeader := fmt.Sprintf("%s  [App/0]  ", timeFormat)
	expectedHeaderLength := len(longestHeader)
	padding := strings.Repeat(" ", expectedHeaderLength-len(logHeader))

	logHeader = logHeader + padding
	coloredLogHeader = coloredLogHeader + padding

	return
}
开发者ID:jalateras,项目名称:cli,代码行数:26,代码来源:helpers.go

示例3: send

func (messageRouter *messageRouter) send(message *logmessage.Message) {
	logMessage := message.GetLogMessage()
	appId := logMessage.GetAppId()

	messageRouter.logger.Debugf("MessageRouter:outgoingLogChan: Searching for sinks with appId [%s].", appId)
	messageRouter.SinkManager.SendTo(appId, message)
	messageRouter.logger.Debugf("MessageRouter:outgoingLogChan: Done sending message.")
}
开发者ID:james-masson,项目名称:loggregator,代码行数:8,代码来源:message_router.go

示例4: manageSinks

func (r *MessageRouter) manageSinks(message *logmessage.Message) {
	logMessage := message.GetLogMessage()
	appId := logMessage.GetAppId()

	if logMessage.GetSourceName() == "App" {
		r.SinkManager.ManageSyslogSinks(appId, logMessage.GetDrainUrls())
	}
}
开发者ID:nkuacac,项目名称:loggregator,代码行数:8,代码来源:message_router.go

示例5: manageSinks

func (messageRouter *messageRouter) manageSinks(message *logmessage.Message) {
	logMessage := message.GetLogMessage()
	appId := logMessage.GetAppId()

	if logMessage.GetSourceName() == "App" {
		messageRouter.SinkManager.manageSyslogSinks(appId, logMessage.GetDrainUrls())
	}
	messageRouter.SinkManager.ensureRecentLogsSinkFor(appId)
}
开发者ID:james-masson,项目名称:loggregator,代码行数:9,代码来源:message_router.go

示例6: simpleLogMessageOutput

func simpleLogMessageOutput(msg *logmessage.Message) (msgText string) {
	logMsg := msg.GetLogMessage()
	msgText = string(logMsg.GetMessage())
	reg, err := regexp.Compile("[\n\r]+$")
	if err != nil {
		return
	}
	msgText = reg.ReplaceAllString(msgText, "")
	return
}
开发者ID:jalateras,项目名称:cli,代码行数:10,代码来源:helpers.go

示例7: getMsgString

func getMsgString(message *logmessage.Message) string {
	return string(message.GetLogMessage().GetMessage())
}
开发者ID:pmuellr,项目名称:cli,代码行数:3,代码来源:log_message_queue_test.go


注:本文中的github.com/cloudfoundry/loggregatorlib/logmessage.Message.GetLogMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。