當前位置: 首頁>>代碼示例>>Golang>>正文


Golang logmessage.NewMessage函數代碼示例

本文整理匯總了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;未經允許,請勿轉載。