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

Refactor Encoder.WriteEntry => Encoder.EncodeEntry #245

Merged
merged 5 commits into from
Jan 13, 2017

Conversation

jcorbin
Copy link
Contributor

@jcorbin jcorbin commented Jan 12, 2017

Encoders should, well, encode. Writing to a sink is a concern for the facility.

@mention-bot
Copy link

@jcorbin, thanks for your PR! By analyzing the history of the files in this pull request, we identified @akshayjshah and @prashantv to be potential reviewers.

@@ -113,7 +113,7 @@ func TestWriterFacilitySyncsOutput(t *testing.T) {
}
}

func TestWriterFacilityWriteEntryFailure(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add another test case here with the short writer from the testutils package?

}

final := jsonPool.Get().(*jsonEncoder)
final.truncate()
final.bytes = append(final.bytes, '{')
enc.LevelFormatter(ent.Level).AddTo(final)
enc.TimeFormatter(ent.Time).AddTo(final)
Copy link
Contributor

Choose a reason for hiding this comment

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

Just for sanity, we should probably use final.LevelFormatter. Same for the time and message formatters.

func TestWriterFacilityShortWrite(t *testing.T) {
fac := WriterFacility(
NewJSONEncoder(testJSONConfig()),
Lock(AddSync(&testutils.ShortWriter{})),
Copy link
Contributor

Choose a reason for hiding this comment

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

Separate note: we don't need the the AddSync anymore.

@akshayjshah akshayjshah merged commit c4d1142 into dev Jan 13, 2017
@jcorbin jcorbin deleted the jcorbin.functional_encoder branch January 13, 2017 00:21
akshayjshah pushed a commit that referenced this pull request Feb 15, 2017
* Refactor Encoder.{Write => Encode}Entry

* Just use final in jsonEncoder.EncodeEntry

* Add a short write test

* Fix dat package

* Drop AddSync from TestWriterFacility*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants