Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LogWatcher Module change required watcher.Close() to be changed to watcher.ConsumerGone() #5

Merged
merged 5 commits into from Feb 28, 2019

Conversation

ghost
Copy link

@ghost ghost commented Feb 12, 2019

Change in the LogWatcher Module change required watcher.Close() to be changed to watcher.ConsumerGone().

driver.go Outdated
@@ -103,7 +103,7 @@ func consumeLog(lf *logPair) {
var msg logger.Message
msg.Line = buf.Line
msg.Source = buf.Source
msg.Partial = buf.Partial
// msg.Partial = buf.Partial

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Partial shouldnt be commented out.

This should take care of building it with the new PartialLogMetaData

diff --git a/driver.go b/driver.go
index 8552e51..dc9c3ff 100644
--- a/driver.go
+++ b/driver.go
@@ -103,7 +103,11 @@ func consumeLog(lf *logPair) {
                var msg logger.Message
                msg.Line = buf.Line
                msg.Source = buf.Source
-               msg.Partial = buf.Partial
+               if buf.PartialLogMetadata != nil {
+                       msg.PLogMetaData.ID = buf.PartialLogMetadata.Id
+                       msg.PLogMetaData.Last = buf.PartialLogMetadata.Last
+                       msg.PLogMetaData.Ordinal = int(buf.PartialLogMetadata.Ordinal)
+               }
                msg.Timestamp = time.Unix(0, buf.TimeNano)
 
                if err := lf.l.Log(&msg); err != nil {
@@ -134,7 +138,7 @@ func (d *driver) ReadLogs(info logger.Info, config logger.ReadConfig) (io.ReadCl
 
                enc := protoio.NewUint32DelimitedWriter(w, binary.BigEndian)
                defer enc.Close()
-               defer watcher.Close()
+               defer watcher.ConsumerGone()
 
                var buf logdriver.LogEntry
                for {
@@ -146,7 +150,7 @@ func (d *driver) ReadLogs(info logger.Info, config logger.ReadConfig) (io.ReadCl
                                }
 
                                buf.Line = msg.Line
-                               buf.Partial = msg.Partial
+                               buf.Partial = msg.PLogMetaData != nil
                                buf.TimeNano = msg.Timestamp.UnixNano()
                                buf.Source = msg.Source

Copy link
Owner

@cpuguy83 cpuguy83 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@cpuguy83 cpuguy83 merged commit d53b76e into cpuguy83:master Feb 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants