本文整理匯總了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)
}