本文整理汇总了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)
}
示例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
}
示例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.")
}
示例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())
}
}
示例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)
}
示例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
}
示例7: getMsgString
func getMsgString(message *logmessage.Message) string {
return string(message.GetLogMessage().GetMessage())
}