本文整理汇总了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)
}
开发者ID:james-masson,项目名称:loggregator,代码行数:7,代码来源:sinkserver_suite_test.go
示例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
}
开发者ID:fujitsu-cf,项目名称:cli,代码行数:7,代码来源:logmessage_testhelper.go
示例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)
}
开发者ID:nimbus-cloud,项目名称:gorouter,代码行数:8,代码来源:logmessage_testhelper.go
示例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)
}
开发者ID:nimbus-cloud,项目名称:gorouter,代码行数:8,代码来源:logmessage_testhelper.go
示例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)
}
开发者ID:nimbus-cloud,项目名称:gorouter,代码行数:9,代码来源:logmessage_testhelper.go
示例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)
}
开发者ID:nkuacac,项目名称:loggregator,代码行数:10,代码来源:sinkserver_suite_test.go
示例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)
}
开发者ID:pxie,项目名称:loggregator,代码行数:24,代码来源:truncating_buffer.go
示例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)
}
开发者ID:nimbus-cloud,项目名称:gorouter,代码行数:6,代码来源:logmessage_testhelper.go
注:本文中的github.com/cloudfoundry/loggregatorlib/logmessage.NewMessage函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论