func StreamDebugLog(ctx context.Context, source base.StreamConnector, args DebugLogParams) (<-chan LogMessage, error) {
	// Prepare URL query attributes.
	attrs := args.URLQuery()

	connection, err := source.ConnectStream("/log", attrs)
	if err != nil {
		return nil, errors.Trace(err)
	}

	messages := make(chan LogMessage)
	go func() {
		defer close(messages)

		for {
			// If the context is done or cancelled, then we can check to ensure
			// that the goroutine is cleaned up.
			if ctx.Err() != nil {
				return
			}

			var msg params.LogMessage
			err := connection.ReadJSON(&msg)
			if err != nil {
				return
			}
			messages <- LogMessage{
				Entity:    msg.Entity,
				Timestamp: msg.Timestamp,
				Severity:  msg.Severity,
				Module:    msg.Module,
				Location:  msg.Location,
				Message:   msg.Message,
				Labels:    msg.Labels,
			}
		}
	}()

	return messages, nil
}
// StreamDebugLog requests the specified debug log records from the
// server and returns a channel of the messages that come back.
StreamDebugLog requests the specified debug log records from the
server and returns a channel of the messages that come back.
// StreamDebugLog requests the specified debug log records from the // server and returns a channel of the messages that come back .
func StreamDebugLog(ctx context.Context, source base.StreamConnector, args DebugLogParams) (<-chan LogMessage, error) {
	attrs := args.URLQuery()
	connection, err := source.ConnectStream("/log", attrs)
	if err != nil {
		return nil, errors.Trace(err)
	}
	messages := make(chan LogMessage)
	go func() {
		defer close(messages)
		for {
			if ctx.Err() != nil {
				return
			}
			var msg params.LogMessage
			err := connection.ReadJSON(&msg)
			if err != nil {
				return
			}
			messages <- LogMessage{
				Entity:    msg.Entity,
				Timestamp: msg.Timestamp,
				Severity:  msg.Severity,
				Module:    msg.Module,
				Location:  msg.Location,
				Message:   msg.Message,
				Labels:    msg.Labels,
			}
		}
	}()
	return messages, nil
}
func StreamDebugLog ( ctx context . Context , source base . StreamConnector , args DebugLogParams ) ( <- chan LogMessage , error ) { attrs := args . URLQuery ( ) connection , err := source . ConnectStream ( " " , attrs ) if err != nil { return nil , errors . Trace ( err ) } messages := make ( chan LogMessage ) go func ( ) { defer close ( messages ) for { if ctx . Err ( ) != nil { return } var msg params . LogMessage err := connection . ReadJSON ( & msg ) if err != nil { return } messages <- LogMessage { Entity : msg . Entity , Timestamp : msg . Timestamp , Severity : msg . Severity , Module : msg . Module , Location : msg . Location , Message : msg . Message , Labels : msg . Labels , } } } ( ) return messages , nil }
StreamDebugLog requests the specified debug log records from the
server and returns a channel of the messages that come back.
StreamDebugLog requests the specified debug log records from the server and returns a channel of the messages that come back .
// Prepare URL query attributes. // If the context is done or cancelled, then we can check to ensure // that the goroutine is cleaned up.