Allow IsTerminal passthrough for SyncLogger#482
Conversation
| ChildWriter() io.Writer | ||
| } | ||
|
|
||
| func resolveWriter(w io.Writer) io.Writer { |
There was a problem hiding this comment.
Note: This method is a pass-through for all io.Writer instances that do not implement the parentWriter interface, thus not breaking the existing behavior.
c3518d9 to
20900b3
Compare
|
Sorry it has taken me a few days to get back to this. The solution here seems straightforward at first glance. However ... it points out the more general issue that passing any decorated Aside from the above I'm not crazy about the method name ChildWriter. I like WrappedWriter slightly better, but I'm not sold on that either. Suggestions anyone? |
|
@ChrisHines No problem about the delay ! I agree that the proposed solution does not account for all cases but I would still distinguish external types and types provided by go-kit. For the first ones, it's harder (impossible ?) to make any guarantee on their exposed interface. For instance, in your example there is just no way to get the underlying For the go-kit provided types, I'd say it's another deal because we do control exactly how they behave and what they expose. I agree that added the support for any As for the name, I'm not too fond of
|
|
@ChrisHines ping ? |
|
Ping received, server overloaded at the moment. ;) I haven't forgotten about this, just too busy this week. |
|
@ChrisHines No worries. I just wanted to make sure my PR had not fallen into a crack. :D I understand being busy, trust me ;) |
|
Closing in favor or #501 which addresses the problem in a less intrusive manner. |
The current implementation of
IsTerminaldoes not properly work when stdout or stderr are used through aSyncLogger.This PR adresses that by defining and implementing a new
interfacefor theSyncWriterthat exposes the encapsulatedio.Writer. This new interface is then used insideterm.gowhich now performs theIsTerminalcheck on the deepestio.Writerinstead.This ensures transivity of the
IsTerminalattribute.There is no API break, tests are passing and a new test was added to cover the new interface.