本文整理汇总了Golang中github.com/cloudfoundry/loggregatorlib/logmessage.NewMessage函数的典型用法代码示例。如果您正苦于以下问题:Golang NewMessage函数的具体用法?Golang NewMessage怎么用?Golang NewMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了NewMessage函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: NewMessage
func NewMessage(messageString, appId string) *logmessage.Message {
logMessage := generateLogMessage(messageString, appId, logmessage.LogMessage_OUT, "App", "")
marshalledLogMessage, _ := proto.Marshal(logMessage)
return logmessage.NewMessage(logMessage, marshalledLogMessage)
}
示例2: NewMessageWithError
func NewMessageWithError(messageString, appId string) (*logmessage.Message, error) {
logMessage := generateLogMessage(messageString, appId, logmessage.LogMessage_OUT, "App", "")
marshalledLogMessage, err := proto.Marshal(logMessage)
return logmessage.NewMessage(logMessage, marshalledLogMessage), err
}
示例3: NewErrMessageWithSourceId
func NewErrMessageWithSourceId(t *testing.T, messageString, appId, sourceId string) *logmessage.Message {
logMessage := generateLogMessage(messageString, appId, logmessage.LogMessage_ERR, "App", sourceId)
marshalledLogMessage, err := proto.Marshal(logMessage)
assert.NoError(t, err)
return logmessage.NewMessage(logMessage, marshalledLogMessage)
}
示例4: NewMessage
func NewMessage(t *testing.T, messageString, appId string) *logmessage.Message {
logMessage := generateLogMessage(messageString, appId, logmessage.LogMessage_OUT, "App", "")
marshalledLogMessage, err := proto.Marshal(logMessage)
assert.NoError(t, err)
return logmessage.NewMessage(logMessage, marshalledLogMessage)
}
示例5: NewMessageWithSyslogDrain
func NewMessageWithSyslogDrain(t *testing.T, messageString, appId string, syslogDrains ...string) *logmessage.Message {
logMessage := generateLogMessage(messageString, appId, logmessage.LogMessage_OUT, "App", "")
logMessage.DrainUrls = syslogDrains
marshalledLogMessage, err := proto.Marshal(logMessage)
assert.NoError(t, err)
return logmessage.NewMessage(logMessage, marshalledLogMessage)
}
示例6: NewMessage
func NewMessage(messageString, appId string) *logmessage.Message {
logMessage := generateLogMessage(messageString, appId, logmessage.LogMessage_OUT, "App", "")
marshalledLogMessage, err := proto.Marshal(logMessage)
if err != nil {
Fail(err.Error())
}
return logmessage.NewMessage(logMessage, marshalledLogMessage)
}
示例7: Run
func (r *truncatingBuffer) Run() {
for v := range r.inputChannel {
r.lock.Lock()
select {
case r.outputChannel <- v:
default:
messageCount := len(r.outputChannel)
r.outputChannel = make(chan *logmessage.Message, cap(r.outputChannel))
lm := generateLogMessage(fmt.Sprintf("Log message output too high. We've dropped %d messages", messageCount), v.GetLogMessage().AppId)
lmBytes, err := proto.Marshal(lm)
if err != nil {
r.logger.Error("TB: Output channel too full. And we failed to notify them. Dropping Buffer.")
continue
}
r.outputChannel <- logmessage.NewMessage(lm, lmBytes)
r.outputChannel <- v
if r.logger != nil {
r.logger.Warn("TB: Output channel too full. Dropped Buffer.")
}
}
r.lock.Unlock()
}
close(r.outputChannel)
}
示例8: NewMessageFromLogMessage
func NewMessageFromLogMessage(t *testing.T, logMessage *logmessage.LogMessage) *logmessage.Message {
marshalledLogMessage, err := proto.Marshal(logMessage)
assert.NoError(t, err)
return logmessage.NewMessage(logMessage, marshalledLogMessage)
}